From b86ee4725e4b9deaed2ade1b067fc4b0147b407f Mon Sep 17 00:00:00 2001 From: Greg Lehey Date: Tue, 28 Sep 1999 22:46:39 +0000 Subject: [PATCH] open_drive: Don't call set_drive_state to take a drive down, do it ourselves. This breaks a vicious circle which caused vinum to dereference a null vp if device nodes were missing. Reported-by: Brad Chisholm Alec Wolman check_drive: Don't take a drive down if it's only referenced. read_drive: Remove unused variable. --- sys/dev/vinum/vinumio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/vinum/vinumio.c b/sys/dev/vinum/vinumio.c index 6cf3f0a23988..132a03264e35 100644 --- a/sys/dev/vinum/vinumio.c +++ b/sys/dev/vinum/vinumio.c @@ -57,7 +57,7 @@ open_drive(struct drive *drive, struct proc *p, int verbose) NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, drive->devicename, p); error = vn_open(&nd, FREAD | FWRITE, 0); /* open the device */ if (error != 0) { /* can't open? */ - set_drive_state(drive->driveno, drive_down, setstate_force); + drive->state = drive_down; /* just force it down */ drive->lasterror = error; if (verbose) log(LOG_WARNING, @@ -191,7 +191,8 @@ close_drive(struct drive *drive) LOCKDRIVE(drive); /* keep the daemon out */ if (drive->vp) close_locked_drive(drive); /* and close it */ - drive->state = drive_down; /* don't tell the system about this one at all */ + if (drive->state > drive_down) /* if it's up */ + drive->state = drive_down; /* make sure it's down */ unlockdrive(drive); } @@ -254,7 +255,6 @@ read_drive(struct drive *drive, void *buf, size_t length, off_t offset) { int error; struct buf *bp; - daddr_t nextbn; long bscale; struct uio uio;