tech-kern archive

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

re: partitionSizeHi in raidframe component label, take 2 (wasRe: partitionSizeHi in raidframe component label)



this patch seems to fix my problem.  i've moved the call to fix
the label into rf_reasonable_label() itself, right before the
valid return, and made the fix up also fix the partitionSizeHi.

greg, what do you think?


.mrg.


Index: rf_netbsdkintf.c
===================================================================
RCS file: /cvsroot/src/sys/dev/raidframe/rf_netbsdkintf.c,v
retrieving revision 1.283
diff -p -r1.283 rf_netbsdkintf.c
*** rf_netbsdkintf.c    4 Mar 2011 17:45:17 -0000       1.283
--- rf_netbsdkintf.c    18 Mar 2011 09:54:39 -0000
*************** oomem:
*** 2950,2956 ****
                /* Got the label.  Does it look reasonable? */
                if (rf_reasonable_label(clabel) && 
                    (rf_component_label_partitionsize(clabel) <= size)) {
-                       rf_fix_old_label_size(clabel, numsecs);
  #ifdef DEBUG
                        printf("Component on: %s: %llu\n",
                                cname, (unsigned long long)size);
--- 2950,2955 ----
*************** rf_reasonable_label(RF_ComponentLabel_t 
*** 3155,3161 ****
             * rf_fix_old_label_size() will fix it.
             */
            rf_component_label_numblocks(clabel) > 0) {
!               /* label looks reasonable enough... */
                return(1);
        }
        return(0);
--- 3154,3165 ----
             * rf_fix_old_label_size() will fix it.
             */
            rf_component_label_numblocks(clabel) > 0) {
!               /*
!                * label looks reasonable enough...
!                * let's make sure it has no old garbage.
!                */
!               rf_fix_old_label_size(clabel,
!                                     rf_component_label_numblocks(clabel));
                return(1);
        }
        return(0);
*************** rf_reasonable_label(RF_ComponentLabel_t 
*** 3167,3181 ****
   * 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)
  {
  
!       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;
        }
  }
  
--- 3171,3198 ----
   * 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.
+  *
+  * The exact same problem, with the same unknown reason, happens to
+  * the partitionSizeHi member as well.
   */
  static void
  rf_fix_old_label_size(RF_ComponentLabel_t *clabel, uint64_t numsecs)
  {
  
!       if (numsecs < ((uint64_t)1 << 32)) {
!               if (clabel->numBlocksHi) {
!                       printf("WARNING: total sectors < 32 bits, yet "
!                              "numBlocksHi set\n"
!                              "WARNING: resetting numBlocksHi to zero.\n");
!                       clabel->numBlocksHi = 0;
!               }
! 
!               if (clabel->partitionSizeHi) {
!                       printf("WARNING: total sectors < 32 bits, yet "
!                              "partitionSizeHi set\n"
!                              "WARNING: resetting partitionSizeHi to zero.\n");
!                       clabel->partitionSizeHi = 0;
!               }
        }
  }
  


Home | Main Index | Thread Index | Old Index