]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2008-02-09 Robert Millan <rmh@aybabtu.com>
authorrobertmh <robertmh@localhost>
Sat, 9 Feb 2008 10:54:44 +0000 (10:54 +0000)
committerrobertmh <robertmh@localhost>
Sat, 9 Feb 2008 10:54:44 +0000 (10:54 +0000)
        * disk/raid.c (grub_raid_scan_device): Add a pair of sanity checks for
        situations in which we can deduce the RAID size and the superblock
        doesn't match it.

ChangeLog
disk/raid.c

index a68720fc7ff5a1d85eb10cfce9181421971bcc15..17b41d46c5e6859d46eff44efe881a10d07cb43a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-02-09  Robert Millan  <rmh@aybabtu.com>
+
+       * disk/raid.c (grub_raid_scan_device): Add a pair of sanity checks for
+       situations in which we can deduce the RAID size and the superblock
+       doesn't match it.
+
 2008-02-09  Robert Millan  <rmh@aybabtu.com>
 
        * disk/lvm.c [GRUB_UTIL] (grub_lvm_memberlist): New function.  Construct
index 0d3177fd154edf66e778462eae178d4cc77afe7e..3c4290a510444bd04e745596b04edad4d67a188a 100644 (file)
@@ -523,6 +523,27 @@ grub_raid_scan_device (const char *name)
 
   /* Add the device to the array. */
   array->device[sb.this_disk.number] = grub_disk_open (name);
+
+  if (array->disk_size != array->device[sb.this_disk.number]->total_sectors)
+    {
+      if (array->total_devs == 1)
+       {
+         grub_dprintf ("raid", "Array contains only one disk, but its size (0x%llx) "
+                       "doesn't match with size indicated by superblock (0x%llx).  "
+                       "Assuming superblock is wrong.\n",
+                       array->device[sb.this_disk.number]->total_sectors, array->disk_size);
+         array->disk_size = array->device[sb.this_disk.number]->total_sectors;
+       }
+      else if (array->level == 1)
+       {
+         grub_dprintf ("raid", "Array is RAID level 1, but the size of disk %d (0x%llx) "
+                       "doesn't match with size indicated by superblock (0x%llx).  "
+                       "Assuming superblock is wrong.\n",
+                       sb.this_disk.number,
+                       array->device[sb.this_disk.number]->total_sectors, array->disk_size);
+         array->disk_size = array->device[sb.this_disk.number]->total_sectors;
+       }
+    }
   
   if (! array->device[sb.this_disk.number])
     {