In message <[EMAIL PROTECTED]>, Bruce Evans writes: >On Wed, 27 Nov 2002, Ian Dowse wrote: >> I think moving the line >> >> tsleep(sc, PRIBIO, "mdwait", 0); >> >> to just after the following `if' statement may do the trick. If the > >Wouldn't Giant locking prevent races here? There is no locking in >sight for the ioctl, but ioctl() holds Giant.
Yes, but mddestroy() assumes that the kthread is waiting in the "mdwait" tsleep() when it calls wakeup(). That won't be true if the kthread has not yet had a chance to run, or if it is waiting to acquire Giant before entering the main loop (or if anything it calls drops Giant). Moving the check of the MD_SHUTDOWN to before the tsleep should catch all of these cases, and Giant ensures that the wakeup() does not occur after the flag is tested but before the tsleep(). Ian To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message