check_drive: If we find an existing drive which is "up" or "down",

just return it.  Don't try to reinitialize it.  This should fix a
number of inconsistencies that some people encountered with "vinum
start".

PR:  30588
PR:  43475
This commit is contained in:
Greg Lehey 2003-05-02 06:04:19 +00:00
parent 82b53b8dc8
commit 5fb5b1b5ca

View File

@ -336,6 +336,8 @@ check_drive(char *devicename)
driveno = find_drive_by_name(devicename, 1); /* if entry doesn't exist, create it */
drive = &vinum_conf.drive[driveno]; /* and get a pointer */
if (drive->state >= drive_down) /* up or down, we know it */
return drive;
if (read_drive_label(drive, 0) == DL_OURS) { /* one of ours */
for (i = 0; i < vinum_conf.drives_allocated; i++) { /* see if the name already exists */
if ((i != driveno) /* not this drive */
@ -774,7 +776,7 @@ vinum_scandisk(char *devicename[], int drives)
part);
drive = check_drive(partname); /* try to open it */
if ((drive->lasterror != 0) /* didn't work, */
||(drive->state != drive_up))
||(drive->state < drive_down))
free_drive(drive); /* get rid of it */
else if (drive->flags & VF_CONFIGURED) /* already read this config, */
log(LOG_WARNING,
@ -798,7 +800,7 @@ vinum_scandisk(char *devicename[], int drives)
part);
drive = check_drive(partname); /* try to open it */
if ((drive->lasterror != 0) /* didn't work, */
||(drive->state != drive_up))
||(drive->state < drive_down))
free_drive(drive); /* get rid of it */
else if (drive->flags & VF_CONFIGURED) /* already read this config, */
log(LOG_WARNING,