On Tue, Dec 26, 2017 at 11:35 AM, Paul Goyette <p...@whooppee.com> wrote: > >> To generate a diff of this commit: > > > # cvs rdiff -u -r1.139 -r1.140 src/sys/netinet6/nd6_nbr.c > @@ -1097,7 +1097,11 @@ nd6_dad_stoptimer(struct dadq *dp) > #ifdef NET_MPSAFE > callout_halt(&dp->dad_timer_ch, NULL); > #else > - callout_halt(&dp->dad_timer_ch, softnet_lock); > + /* XXX still need the trick for softnet_lock */ > + if (mutex_owned(softnet_lock)) > + callout_halt(&dp->dad_timer_ch, softnet_lock); > + else > + callout_halt(&dp->dad_timer_ch, NULL); > #endif > } > > This goes against the restriction noted in the mutex(9) man page: > > [mutex_owned()] should not be used to make locking decisions at run > time. ... > > Please find a different way to make this run-time decision.
I know the restriction well, but for softnet_lock, following the restriction is sometimes hard. I don't have an option to statically decide if softnet_lock is held or not without messing up many codes. An option we can have here is to give up using callout_halt and use callout_stop that may be unsafe. Which is better for us? ozaki-r