Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/raidframe We need to be slightly more clever during ...



details:   https://anonhg.NetBSD.org/src/rev/73c18e63abeb
branches:  trunk
changeset: 486748:73c18e63abeb
user:      oster <oster%NetBSD.org@localhost>
date:      Sun May 28 05:23:41 2000 +0000

description:
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:

 sys/dev/raidframe/rf_disks.c       |  20 +++++++++++++++-
 sys/dev/raidframe/rf_netbsdkintf.c |  43 ++++++++++++++++---------------------
 2 files changed, 37 insertions(+), 26 deletions(-)

diffs (126 lines):

diff -r bfa41c4afe49 -r 73c18e63abeb sys/dev/raidframe/rf_disks.c
--- a/sys/dev/raidframe/rf_disks.c      Sun May 28 05:17:25 2000 +0000
+++ b/sys/dev/raidframe/rf_disks.c      Sun May 28 05:23:41 2000 +0000
@@ -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 @@
                }
 #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 @@
                                        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 -r bfa41c4afe49 -r 73c18e63abeb sys/dev/raidframe/rf_netbsdkintf.c
--- a/sys/dev/raidframe/rf_netbsdkintf.c        Sun May 28 05:17:25 2000 +0000
+++ b/sys/dev/raidframe/rf_netbsdkintf.c        Sun May 28 05:23:41 2000 +0000
@@ -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 @@
                        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 @@
        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 @@
 
        /* 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 @@
                                        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 @@
                if (ac->vp) {
                        VOP_CLOSE(ac->vp, FREAD, NOCRED, 0);
                        vput(ac->vp);
+                       ac->vp = NULL;
                }
                ac = ac->next;
        }



Home | Main Index | Thread Index | Old Index