Add debug calls to catch occasional deadlocks on drives. The problem
is probably gone, but the debug checks remain for a while. update_plex_config: Catch yet another divide-by-zero problem when detaching the last subdisk from a striped plex. Uncovered-by: Michael Reifenberger <root@nihil.plaut.de>
This commit is contained in:
parent
42d21b86b2
commit
ec3a729692
@ -590,7 +590,7 @@ void
|
||||
free_drive(struct drive *drive)
|
||||
{
|
||||
if (drive->state > drive_referenced) { /* real drive */
|
||||
lockdrive(drive);
|
||||
LOCKDRIVE(drive);
|
||||
if (drive->vp != NULL) /* device open */
|
||||
vn_close(drive->vp, FREAD | FWRITE, FSCRED, drive->p);
|
||||
if (drive->freelist)
|
||||
@ -1827,20 +1827,25 @@ update_plex_config(int plexno, int diskconfig)
|
||||
* of each subdisk and return it to the drive.
|
||||
*/
|
||||
if (plex->length > 0) {
|
||||
remainder = (int) (plex->length % ((u_int64_t) plex->stripesize * data_sds)); /* are we exact? */
|
||||
if (remainder) { /* no */
|
||||
log(LOG_INFO, "vinum: removing %d blocks of partial stripe at the end of %s\n",
|
||||
remainder,
|
||||
plex->name);
|
||||
plex->length -= remainder; /* shorten the plex */
|
||||
remainder /= data_sds; /* spread the remainder amongst the sds */
|
||||
for (sdno = 0; sdno < plex->subdisks; sdno++) {
|
||||
sd = &SD[plex->sdnos[sdno]]; /* point to the subdisk */
|
||||
return_drive_space(sd->driveno, /* return the space */
|
||||
sd->driveoffset + sd->sectors - remainder,
|
||||
remainder);
|
||||
sd->sectors -= remainder; /* and shorten it */
|
||||
}
|
||||
if (data_sds > 0) {
|
||||
if (plex->stripesize > 0) {
|
||||
remainder = (int) (plex->length % ((u_int64_t) plex->stripesize * data_sds)); /* are we exact? */
|
||||
if (remainder) { /* no */
|
||||
log(LOG_INFO, "vinum: removing %d blocks of partial stripe at the end of %s\n",
|
||||
remainder,
|
||||
plex->name);
|
||||
plex->length -= remainder; /* shorten the plex */
|
||||
remainder /= data_sds; /* spread the remainder amongst the sds */
|
||||
for (sdno = 0; sdno < plex->subdisks; sdno++) {
|
||||
sd = &SD[plex->sdnos[sdno]]; /* point to the subdisk */
|
||||
return_drive_space(sd->driveno, /* return the space */
|
||||
sd->driveoffset + sd->sectors - remainder,
|
||||
remainder);
|
||||
sd->sectors -= remainder; /* and shorten it */
|
||||
}
|
||||
}
|
||||
} else /* no data sds, */
|
||||
plex->length = 0; /* reset length */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user