From 947ff5e0c7e877bcb6893dea15bd35000bf2d117 Mon Sep 17 00:00:00 2001 From: iedowse Date: Sat, 30 Nov 2002 22:03:53 +0000 Subject: [PATCH] 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 --- sys/dev/md/md.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c index e2922fc98b7a..acb09c0d7c5b 100644 --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -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; }