Remember to close the component if we decide it's not suitable for use

as a hot spare.  Closes PR#20989 by David Brownlee.
This commit is contained in:
oster 2003-04-13 22:07:11 +00:00
parent 44617bfaa7
commit 351bc1e187

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_disks.c,v 1.41 2003/03/21 23:11:22 dsl Exp $ */
/* $NetBSD: rf_disks.c,v 1.42 2003/04/13 22:07:11 oster Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
@ -67,7 +67,7 @@
***************************************************************/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.41 2003/03/21 23:11:22 dsl Exp $");
__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.42 2003/04/13 22:07:11 oster Exp $");
#include <dev/raidframe/raidframevar.h>
@ -1050,6 +1050,7 @@ rf_add_hot_spare(raidPtr, sparePtr)
if (disks[spare_number].status != rf_ds_optimal) {
RF_ERRORMSG1("Warning: spare disk %s failed TUR\n",
sparePtr->component_name);
rf_close_component(raidPtr, raidPtr->raid_cinfo[0][raidPtr->numCol+spare_number].ci_vp, 0);
ret=EINVAL;
goto fail;
} else {
@ -1067,6 +1068,7 @@ rf_add_hot_spare(raidPtr, sparePtr)
bs = 1 << raidPtr->logBytesPerSector;
if (disks[spare_number].blockSize != bs) {
RF_ERRORMSG3("Block size of %d on spare disk %s is not the same as on other disks (%d)\n", disks[spare_number].blockSize, disks[spare_number].devname, bs);
rf_close_component(raidPtr, raidPtr->raid_cinfo[0][raidPtr->numCol+spare_number].ci_vp, 0);
ret = EINVAL;
goto fail;
}
@ -1075,6 +1077,7 @@ rf_add_hot_spare(raidPtr, sparePtr)
disks[spare_number].devname,
disks[spare_number].blockSize,
(long int) raidPtr->sectorsPerDisk);
rf_close_component(raidPtr, raidPtr->raid_cinfo[0][raidPtr->numCol+spare_number].ci_vp, 0);
ret = EINVAL;
goto fail;
} else {