1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-16 10:20:30 +00:00

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.
This commit is contained in:
Greg Lehey 1999-09-28 22:46:39 +00:00
parent 3465ababcf
commit b86ee4725e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=51775

View File

@ -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;