From 301ef407a4be035fe9e4393265dfb82c5ea09acf Mon Sep 17 00:00:00 2001 From: Greg Lehey Date: Sat, 10 Apr 1999 08:10:24 +0000 Subject: daemon_save_config: Fix a potential drive deadlock when saving config to a non-existent drive. Add debug calls to catch occasional deadlocks on drives. The problem (above) is probably gone, but the debug checks remain for a while. --- sys/dev/vinum/vinumio.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'sys') diff --git a/sys/dev/vinum/vinumio.c b/sys/dev/vinum/vinumio.c index 5206662d38391..43c7181f0fb0f 100644 --- a/sys/dev/vinum/vinumio.c +++ b/sys/dev/vinum/vinumio.c @@ -214,7 +214,7 @@ void close_drive(struct drive *drive) { if (drive->vp) { - lockdrive(drive); /* keep the daemon out */ + LOCKDRIVE(drive); /* keep the daemon out */ vn_close(drive->vp, FREAD | FWRITE, NOCRED, drive->p); if (drive->vp->v_usecount) /* XXX shouldn't happen */ log(LOG_WARNING, @@ -732,7 +732,7 @@ daemon_save_config(void) for (driveno = 0; driveno < vinum_conf.drives_allocated; driveno++) { drive = &vinum_conf.drive[driveno]; /* point to drive */ if (drive->state > drive_referenced) { - lockdrive(drive); /* don't let it change */ + LOCKDRIVE(drive); /* don't let it change */ /* * First, do some drive consistency checks. Some @@ -754,6 +754,7 @@ daemon_save_config(void) &&(drive->state > drive_down)) { /* and it thinks it's not down */ unlockdrive(drive); set_drive_state(driveno, drive_down, setstate_force); /* tell it what's what */ + continue; } if ((drive->state == drive_down) /* it's down */ &&(drive->vp != NULL)) { /* but open, */ @@ -797,7 +798,8 @@ daemon_save_config(void) } else written_config = 1; /* we've written it on at least one drive */ } - } + } else /* not worth looking at, */ + unlockdrive(drive); /* just unlock it again */ } } Free(vhdr); -- cgit v1.3