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.
This commit is contained in:
Greg Lehey 1999-04-10 08:10:24 +00:00
parent c73d47fca5
commit 301ef407a4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=45536

View File

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