diff options
| author | oster <oster@NetBSD.org> | 2000-05-28 22:53:49 +0000 |
|---|---|---|
| committer | oster <oster@NetBSD.org> | 2000-05-28 22:53:49 +0000 |
| commit | 39a667120fa994d10a4770879fe83d19f5ac1a72 (patch) | |
| tree | faae6913d721b9cdb74b8c32a886e627098996bb /sys/dev/raidframe | |
| parent | 5036bc4fc0ba579276fb159160011600248b36da (diff) | |
In the event that an up-to-date component cannot be located for a specific
position, see if there is a failed component still hanging around that
we can use instead (but still mark it as failed). This leads to more
reasonable behaviour (and fewer surprises!) when autoconfiguring and
failed (or previously failed) components are still on the system.
Diffstat (limited to 'sys/dev/raidframe')
| -rw-r--r-- | sys/dev/raidframe/rf_disks.c | 72 | ||||
| -rw-r--r-- | sys/dev/raidframe/rf_netbsd.h | 3 |
2 files changed, 58 insertions, 17 deletions
diff --git a/sys/dev/raidframe/rf_disks.c b/sys/dev/raidframe/rf_disks.c index 719e02f1bce..8c3a25e5fc1 100644 --- a/sys/dev/raidframe/rf_disks.c +++ b/sys/dev/raidframe/rf_disks.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_disks.c,v 1.28 2000/05/28 05:23:42 oster Exp $ */ +/* $NetBSD: rf_disks.c,v 1.29 2000/05/28 22:53:49 oster Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. * All rights reserved. @@ -410,8 +410,10 @@ rf_AutoConfigureDisks(raidPtr, cfgPtr, auto_config) if (ac->clabel->mod_counter > mod_counter) { mod_counter = ac->clabel->mod_counter; } + ac->flag = 0; /* clear the general purpose flag */ ac = ac->next; } + if (mod_counter == -1) { /* mod_counters were all negative!?!?!? Ok, we can deal with that. */ @@ -425,21 +427,6 @@ rf_AutoConfigureDisks(raidPtr, cfgPtr, auto_config) } #endif } - /* close the device for the ones that don't match */ - - ac = auto_config; - while(ac!=NULL) { - if (ac->clabel->mod_counter != mod_counter) { - VOP_CLOSE(ac->vp, FREAD, NOCRED, 0); - vput(ac->vp); - ac->vp = NULL; -#if DEBUG - printf("Ignoring %s due to low mod_counter.\n", - ac->devname); -#endif - } - ac = ac->next; - } for (r = 0; r < raidPtr->numRow; r++) { numFailuresThisRow = 0; @@ -460,6 +447,9 @@ rf_AutoConfigureDisks(raidPtr, cfgPtr, auto_config) (ac->clabel->column == c) && (ac->clabel->mod_counter == mod_counter)) { /* it's this one... */ + /* flag it as 'used', so we don't + free it later. */ + ac->flag = 1; #if DEBUG printf("Found: %s at %d,%d\n", ac->devname,r,c); @@ -470,6 +460,40 @@ rf_AutoConfigureDisks(raidPtr, cfgPtr, auto_config) ac=ac->next; } + if (ac==NULL) { + /* we didn't find an exact match with a + correct mod_counter above... can we + find one with an incorrect mod_counter + to use instead? (this one, if we find + it, will be marked as failed once the + set configures) + */ + + ac = auto_config; + while(ac!=NULL) { + if (ac->clabel==NULL) { + /* big-time bad news. */ + goto fail; + } + if ((ac->clabel->row == r) && + (ac->clabel->column == c)) { + /* it's this one... + flag it as 'used', so we + don't free it later. */ + ac->flag = 1; +#if DEBUG + printf("Found(low mod_counter): %s at %d,%d\n", + ac->devname,r,c); +#endif + + break; + } + ac=ac->next; + } + } + + + if (ac!=NULL) { /* Found it. Configure it.. */ diskPtr->blockSize = ac->clabel->blockSize; @@ -545,6 +569,22 @@ rf_AutoConfigureDisks(raidPtr, cfgPtr, auto_config) raidPtr->status[r] = rf_rs_degraded; } + /* close the device for the ones that didn't get used */ + + ac = auto_config; + while(ac!=NULL) { + if (ac->flag == 0) { + VOP_CLOSE(ac->vp, FREAD, NOCRED, 0); + vput(ac->vp); + ac->vp = NULL; +#if DEBUG + printf("Released %s from auto-config set.\n", + ac->devname); +#endif + } + ac = ac->next; + } + raidPtr->mod_counter = mod_counter; /* note the state of the parity, if any */ diff --git a/sys/dev/raidframe/rf_netbsd.h b/sys/dev/raidframe/rf_netbsd.h index 6c2a1e14947..3bb3c7eaf0e 100644 --- a/sys/dev/raidframe/rf_netbsd.h +++ b/sys/dev/raidframe/rf_netbsd.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsd.h,v 1.11 2000/03/27 03:01:33 oster Exp $ */ +/* $NetBSD: rf_netbsd.h,v 1.12 2000/05/28 22:53:49 oster Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -121,6 +121,7 @@ struct raidcinfo { /* XXX probably belongs in a different .h file. */ typedef struct RF_AutoConfig_s { char devname[56]; /* the name of this component */ + int flag; /* a general-purpose flag */ dev_t dev; /* the device for this component */ struct vnode *vp; /* Mr. Vnode Pointer */ RF_ComponentLabel_t *clabel; /* the label */ |
