summaryrefslogtreecommitdiff
path: root/sys/dev/raidframe
diff options
context:
space:
mode:
authoroster <oster@NetBSD.org>2000-05-28 05:23:41 +0000
committeroster <oster@NetBSD.org>2000-05-28 05:23:41 +0000
commitf329fb84ad244a55122eb41b2c5b6279bc66a13d (patch)
treef93f8588954bb5eb3a866f21867ba111f14779f2 /sys/dev/raidframe
parent141dcca2511152dc3d74890726b91d36217c1f6e (diff)
We need to be slightly more clever during auto-configuration, to make
sure that we a) don't ignore components with correct mod-counters, and b) do ignore components with bogus mod-counters.
Diffstat (limited to 'sys/dev/raidframe')
-rw-r--r--sys/dev/raidframe/rf_disks.c20
-rw-r--r--sys/dev/raidframe/rf_netbsdkintf.c43
2 files changed, 37 insertions, 26 deletions
diff --git a/sys/dev/raidframe/rf_disks.c b/sys/dev/raidframe/rf_disks.c
index 1eec9efcedb..719e02f1bce 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.27 2000/03/31 02:05:24 oster Exp $ */
+/* $NetBSD: rf_disks.c,v 1.28 2000/05/28 05:23:42 oster Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -425,6 +425,21 @@ 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;
@@ -442,7 +457,8 @@ rf_AutoConfigureDisks(raidPtr, cfgPtr, auto_config)
goto fail;
}
if ((ac->clabel->row == r) &&
- (ac->clabel->column == c)) {
+ (ac->clabel->column == c) &&
+ (ac->clabel->mod_counter == mod_counter)) {
/* it's this one... */
#if DEBUG
printf("Found: %s at %d,%d\n",
diff --git a/sys/dev/raidframe/rf_netbsdkintf.c b/sys/dev/raidframe/rf_netbsdkintf.c
index c3ce585f023..4a95609f2a4 100644
--- a/sys/dev/raidframe/rf_netbsdkintf.c
+++ b/sys/dev/raidframe/rf_netbsdkintf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_netbsdkintf.c,v 1.85 2000/05/28 03:00:31 oster Exp $ */
+/* $NetBSD: rf_netbsdkintf.c,v 1.86 2000/05/28 05:23:41 oster Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -2907,28 +2907,9 @@ rf_create_auto_sets(ac_list)
cset = config_sets;
while(cset!=NULL) {
if (rf_does_it_fit(cset, ac)) {
- /* looks like it matches... how about
- the mod_counter? */
-
- if (cset->ac->clabel->mod_counter ==
- ac->clabel->mod_counter) {
- ac->next = cset->ac;
- cset->ac = ac;
- } else {
- /* else we ignore this, as
- it used to belong to a
- valid set, but is no
- longer in sync. It's
- effectively a renegade,
- and we don't want to add
- it *anywhere*. Close it,
- and carry on.
- */
- VOP_CLOSE(ac->vp, FREAD,
- NOCRED, 0);
- vput(ac->vp);
-
- }
+ /* looks like it matches... */
+ ac->next = cset->ac;
+ cset->ac = ac;
break;
}
cset = cset->next;
@@ -3025,6 +3006,7 @@ rf_have_enough_components(cset)
int num_rows;
int num_cols;
int num_missing;
+ int mod_counter;
/* check to see that we have enough 'live' components
of this set. If so, we can configure it if necessary */
@@ -3034,6 +3016,17 @@ rf_have_enough_components(cset)
/* XXX Check for duplicate components!?!?!? */
+ /* Determine what the mod_counter is supposed to be for this set. */
+
+ mod_counter = -1;
+ ac = cset->ac;
+ while(ac!=NULL) {
+ if (ac->clabel->mod_counter > mod_counter) {
+ mod_counter = ac->clabel->mod_counter;
+ }
+ ac = ac->next;
+ }
+
num_missing = 0;
auto_config = cset->ac;
@@ -3046,7 +3039,8 @@ rf_have_enough_components(cset)
goto fail;
}
if ((ac->clabel->row == r) &&
- (ac->clabel->column == c)) {
+ (ac->clabel->column == c) &&
+ (ac->clabel->mod_counter == mod_counter)) {
/* it's this one... */
#if DEBUG
printf("Found: %s at %d,%d\n",
@@ -3182,6 +3176,7 @@ rf_release_all_vps(cset)
if (ac->vp) {
VOP_CLOSE(ac->vp, FREAD, NOCRED, 0);
vput(ac->vp);
+ ac->vp = NULL;
}
ac = ac->next;
}