Move the check for the MD_SHUTDOWN flag to before the tsleep() call
in the per-device kthread. This ensures that synchronisation with mddestroy() succeeds even if the kthread was not waiting in tsleep() at the time of the wakeup(). Among other things, this fixes the problem of mdconfig getting stuck when an attempt is made to use a zero-length file as a vnode-type backing store. Approved by: re
This commit is contained in:
parent
de5305d5b6
commit
e176446dc8
@ -577,12 +577,12 @@ md_kthread(void *arg)
|
||||
bioq_remove(&sc->bio_queue, bp);
|
||||
/* XXX: UNLOCK(unique unit numbers) */
|
||||
if (!bp) {
|
||||
tsleep(sc, PRIBIO, "mdwait", 0);
|
||||
if (sc->flags & MD_SHUTDOWN) {
|
||||
sc->procp = NULL;
|
||||
wakeup(&sc->procp);
|
||||
kthread_exit(0);
|
||||
}
|
||||
tsleep(sc, PRIBIO, "mdwait", 0);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user