]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
imsm: robustify recovery-start detection
authorDan Williams <dan.j.williams@intel.com>
Wed, 26 May 2010 20:33:43 +0000 (13:33 -0700)
committerDan Williams <dan.j.williams@intel.com>
Wed, 26 May 2010 20:33:43 +0000 (13:33 -0700)
update_recovery_start() assumed that the out-of-sync disk would always be
marked as IMSM_ORD_REBUILD in the disk_ord_tbl, but the segmentation
fault reported by Andy proves otherwise.  This might also be explained by
an interrupted rebuild and the disk has not yet been marked missing.

https://bugzilla.redhat.com/show_bug.cgi?id=592030

Reported-by: Andy Lutomirski <luto@mit.edu>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
super-intel.c

index bdd7a968abbcd3ed95e082a54220317935791c44..dd9699de9df75f3316994c636ce127decb1f1139 100644 (file)
@@ -4044,6 +4044,15 @@ static void update_recovery_start(struct imsm_dev *dev, struct mdinfo *array)
                        rebuild = d;
                }
 
+       if (!rebuild) {
+               /* (?) none of the disks are marked with
+                * IMSM_ORD_REBUILD, so assume they are missing and the
+                * disk_ord_tbl was not correctly updated
+                */
+               dprintf("%s: failed to locate out-of-sync disk\n", __func__);
+               return;
+       }
+
        units = __le32_to_cpu(dev->vol.curr_migr_unit);
        rebuild->recovery_start = units * blocks_per_migr_unit(dev);
 }