From c46d09a85bf819af5c5ddc086609e1354ec0af8a Mon Sep 17 00:00:00 2001 From: Greg Lehey Date: Wed, 13 Oct 1999 03:17:59 +0000 Subject: [PATCH] Fix another instance of vinum_scandisk giving a request to the daemon and then doing it itself, resulting in a panic downed drives. Sleuth-work-by: Christopher Masto Remove dummy function initsd, which is now (implemented) in vinumrevive.c vinum_scandisk: Check that a drive is up before reading from it. This is probably excessive paranoia. --- sys/dev/vinum/vinumio.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/sys/dev/vinum/vinumio.c b/sys/dev/vinum/vinumio.c index 132a03264e35..af07fa3a7cd8 100644 --- a/sys/dev/vinum/vinumio.c +++ b/sys/dev/vinum/vinumio.c @@ -33,6 +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.26 1999/10/12 04:31:54 grog Exp grog $ * $FreeBSD$ */ @@ -487,7 +488,8 @@ check_drive(char *devicename) } else { if (drive->lasterror == 0) drive->lasterror = ENODEV; - set_drive_state(drive->driveno, drive_down, setstate_force); + close_drive(drive); + drive->state = drive_down; } return drive; } @@ -836,13 +838,6 @@ write_volume_label(int volno) return error; } -/* Initialize a subdisk */ -int -initsd(int sdno) -{ - return 0; -} - /* Look at all disks on the system for vinum slices */ int vinum_scandisk(char *devicename[], int drives) @@ -955,8 +950,13 @@ vinum_scandisk(char *devicename[], int drives) else log(LOG_INFO, "vinum: updating configuration from %s\n", drive->devicename); - /* Read in both copies of the configuration information */ - error = read_drive(drive, config_text, MAXCONFIG * 2, VINUM_CONFIG_OFFSET); + if (drive->state == drive_up) + /* Read in both copies of the configuration information */ + error = read_drive(drive, config_text, MAXCONFIG * 2, VINUM_CONFIG_OFFSET); + else { + error = EIO; + printf("vinum_scandisk: %s is %s\n", drive->devicename, drive_state(drive->state)); + } if (error != 0) { log(LOG_ERR, "vinum: Can't read device %s, error %d\n", drive->devicename, error);