Current-Users archive

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

re: Recent netbsd-5 changes seem to make (autoconfig) raidframe trouble



can you please try this patch, against -current?  if it works
for you, i'll get it, and the prior patch it needs pulled up.
you'll have to update and make sure you have:

$NetBSD: rf_netbsdkintf.c,v 1.276 2010/12/04 10:01:16 mrg Exp $

for this patch to work.  it worked for my failure mode.


Index: rf_netbsdkintf.c
===================================================================
RCS file: /cvsroot/src/sys/dev/raidframe/rf_netbsdkintf.c,v
retrieving revision 1.276
diff -p -r1.276 rf_netbsdkintf.c
*** rf_netbsdkintf.c    4 Dec 2010 10:01:16 -0000       1.276
--- rf_netbsdkintf.c    4 Dec 2010 10:23:42 -0000
*************** void rf_release_all_vps(RF_ConfigSet_t *
*** 341,346 ****
--- 341,347 ----
  void rf_cleanup_config_set(RF_ConfigSet_t *);
  int rf_have_enough_components(RF_ConfigSet_t *);
  int rf_auto_config_set(RF_ConfigSet_t *, int *);
+ static void rf_fix_old_label_size(RF_ComponentLabel_t *, uint64_t);
  
  static int raidautoconfig = 0; /* Debugging, mostly.  Set to 0 to not
                                  allow autoconfig to take place.
*************** oomem:
*** 2988,2993 ****
--- 2989,2995 ----
                /* Got the label.  Does it look reasonable? */
                if (rf_reasonable_label(clabel) && 
                    (clabel->partitionSize <= size)) {
+                       rf_fix_old_label_size(clabel, numsecs);
  #ifdef DEBUG
                        printf("Component on: %s: %llu\n",
                                cname, (unsigned long long)size);
*************** rf_reasonable_label(RF_ComponentLabel_t 
*** 3196,3201 ****
--- 3198,3224 ----
  }
  
  
+ /*
+  * For reasons yet unknown, some old component labels have garbage in
+  * the newer numBlocksHi region, and this causes lossage.  Since those
+  * disks will also have numsecs set to less than 32 bits of sectors,
+  * we can determine when this corruption has occured, and fix it.
+  */
+ static void
+ rf_fix_old_label_size(RF_ComponentLabel_t *clabel, uint64_t numsecs)
+ {
+       uint64_t numBlocks = clabel->numBlocks;
+ 
+       numBlocks |= (uint64_t)clabel->numBlocksHi << 32;
+ 
+       if (clabel->numBlocksHi && numsecs < ((uint64_t)1 << 32)) {
+               printf("WARNING: total sectors < 32 bits, yet numBlocksHi set\n"
+                      "WARNING: resetting numBlocksHi to zero.\n");
+               clabel->numBlocksHi = 0;
+       }
+ }
+ 
+ 
  #ifdef DEBUG
  void
  rf_print_component_label(RF_ComponentLabel_t *clabel)


Home | Main Index | Thread Index | Old Index