From 839832f8d01e1d47672b92fbe22d20acdaafca72 Mon Sep 17 00:00:00 2001 From: Greg Lehey Date: Tue, 29 Jun 1999 04:08:51 +0000 Subject: close_drive: Correct race condition between caller and daemon. Tripped-over-by: Zach Heilig Bernd Walter Niels Chr. Bank-Pedersen --- sys/dev/vinum/vinumio.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'sys/dev/vinum/vinumio.c') diff --git a/sys/dev/vinum/vinumio.c b/sys/dev/vinum/vinumio.c index ef2658de0554c..2fc55448b15b0 100644 --- a/sys/dev/vinum/vinumio.c +++ b/sys/dev/vinum/vinumio.c @@ -33,7 +33,7 @@ * otherwise) arising in any way out of the use of this software, even if * advised of the possibility of such damage. * - * $Id: vinumio.c,v 1.29 1999/06/24 08:55:02 grog Exp $ + * $Id: vinumio.c,v 1.24 1999/03/23 02:00:52 grog Exp grog $ */ #include @@ -193,11 +193,10 @@ init_drive(struct drive *drive, int verbose) void close_drive(struct drive *drive) { - if (drive->vp) { - LOCKDRIVE(drive); /* keep the daemon out */ + LOCKDRIVE(drive); /* keep the daemon out */ + if (drive->vp) close_locked_drive(drive); /* and close it */ - unlockdrive(drive); - } + unlockdrive(drive); } /* @@ -272,7 +271,7 @@ driveio(struct drive *drive, char *buf, size_t length, off_t offset, int flag) int len = min(length, MAXBSIZE); /* maximum block device transfer is MAXBSIZE */ bp = geteblk(len); /* get a buffer header */ - bp->b_flags = flag; /* get locked */ + bp->b_flags = flag; bp->b_dev = drive->vp->v_un.vu_specinfo->si_rdev; /* device */ bp->b_blkno = offset / drive->partinfo.disklab->d_secsize; /* block number */ bp->b_data = buf; -- cgit v1.2.3