summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgrog <grog@FreeBSD.org>1999-06-29 04:08:51 +0000
committergrog <grog@FreeBSD.org>1999-06-29 04:08:51 +0000
commit3645b5b2f43c2aabe95a480e1cc594bb6e8ee2c2 (patch)
tree3fc860fe21147a0847d360d726e5b16ee27bdd23
parent37d4cc3c4670fee23da62ad981be9b9a6c6515cc (diff)
downloadFreeBSD-src-3645b5b2f43c2aabe95a480e1cc594bb6e8ee2c2.zip
FreeBSD-src-3645b5b2f43c2aabe95a480e1cc594bb6e8ee2c2.tar.gz
close_drive:
Correct race condition between caller and daemon. Tripped-over-by: Zach Heilig <zach@uffdaonline.net> Bernd Walter <ticso@cicely.de> Niels Chr. Bank-Pedersen <ncbp@bank-pedersen.dk>
-rw-r--r--sys/dev/vinum/vinumio.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/sys/dev/vinum/vinumio.c b/sys/dev/vinum/vinumio.c
index ef2658d..2fc5544 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 <dev/vinum/vinumhdr.h>
@@ -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;
OpenPOWER on IntegriCloud