summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgrog <grog@FreeBSD.org>1999-09-28 22:46:39 +0000
committergrog <grog@FreeBSD.org>1999-09-28 22:46:39 +0000
commit6f7810dec0787c294ab45864b71a13047108db82 (patch)
tree3360d4f842b96d3f6ec7a9e8180f7e50166b1cbf
parent0baa5f682a4775bae1bed696f009935b625b08d8 (diff)
downloadFreeBSD-src-6f7810dec0787c294ab45864b71a13047108db82.zip
FreeBSD-src-6f7810dec0787c294ab45864b71a13047108db82.tar.gz
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 <sasblc@unx.sas.com> Alec Wolman <wolman@cs.washington.edu> check_drive: Don't take a drive down if it's only referenced. read_drive: Remove unused variable.
-rw-r--r--sys/dev/vinum/vinumio.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/vinum/vinumio.c b/sys/dev/vinum/vinumio.c
index 6cf3f0a..132a032 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;
OpenPOWER on IntegriCloud