diff options
author | grog <grog@FreeBSD.org> | 2003-05-05 05:28:15 +0000 |
---|---|---|
committer | grog <grog@FreeBSD.org> | 2003-05-05 05:28:15 +0000 |
commit | b5095f91a491b194e7c2f2822429864960639a80 (patch) | |
tree | 59c761df124a3995f53c9aed2853c6b5fb93fe53 /sys/dev/vinum | |
parent | 933dd0f26d2badc066624de5d1b9d8de41cd123f (diff) | |
download | FreeBSD-src-b5095f91a491b194e7c2f2822429864960639a80.zip FreeBSD-src-b5095f91a491b194e7c2f2822429864960639a80.tar.gz |
free_vinum: Rearrange sequence of actions to avoid potential race
condition when shutting down.
Diffstat (limited to 'sys/dev/vinum')
-rw-r--r-- | sys/dev/vinum/vinum.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/sys/dev/vinum/vinum.c b/sys/dev/vinum/vinum.c index a92b646..d1d3c82 100644 --- a/sys/dev/vinum/vinum.c +++ b/sys/dev/vinum/vinum.c @@ -35,7 +35,7 @@ * otherwise) arising in any way out of the use of this software, even if * advised of the possibility of such damage. * - * $Id: vinum.c,v 1.41 2003/04/28 06:15:36 grog Exp grog $ + * $Id: vinum.c,v 1.42 2003/05/04 05:25:14 grog Exp grog $ * $FreeBSD$ */ @@ -198,8 +198,11 @@ free_vinum(int cleardrive) int i; int drives_allocated = vinum_conf.drives_allocated; - EVENTHANDLER_DEREGISTER(dev_clone, dev_clone_tag); - + while ((vinum_conf.flags & (VF_STOPPING | VF_DAEMONOPEN)) + == (VF_STOPPING | VF_DAEMONOPEN)) { /* at least one daemon open, we're stopping */ + queue_daemon_request(daemonrq_return, (union daemoninfo) 0); /* stop the daemon */ + tsleep(&vinumclose, PUSER, "vstop", 1); /* and wait for it */ + } if (DRIVE != NULL) { if (cleardrive) { /* remove the vinum config */ for (i = 0; i < drives_allocated; i++) @@ -210,11 +213,6 @@ free_vinum(int cleardrive) } Free(DRIVE); } - while ((vinum_conf.flags & (VF_STOPPING | VF_DAEMONOPEN)) - == (VF_STOPPING | VF_DAEMONOPEN)) { /* at least one daemon open, we're stopping */ - queue_daemon_request(daemonrq_return, (union daemoninfo) 0); /* stop the daemon */ - tsleep(&vinumclose, PUSER, "vstop", 1); /* and wait for it */ - } if (SD != NULL) { for (i = 0; i < vinum_conf.subdisks_allocated; i++) { struct sd *sd = &SD[i]; @@ -244,6 +242,7 @@ free_vinum(int cleardrive) } bzero(&vinum_conf, sizeof(vinum_conf)); vinum_conf.version = VINUMVERSION; /* reinstate version number */ + EVENTHANDLER_DEREGISTER(dev_clone, dev_clone_tag); } STATIC int |