[PATCH 4 of 9] MD: analyze_sbs failure if bad superblocks

[PATCH 4 of 9] MD: analyze_sbs failure if bad superblocks

am 24.05.2011 05:06:31 von Jonathan Brassow

Patch name: md-analyze_sbs-failure-if-bad-superblocks.patch

MD's superblock reader function should fail if all superblocks are bad.

analyze_sbs should return -EINVAL if the 'freshest'/best superblock cannot
be validated. This is especially important to dm-raid.c, as it uses md_run
at creation time to validate array transitions.

Signed-off-by: Jonathan Brassow

Index: linux-2.6/drivers/md/md.c
============================================================ =======
--- linux-2.6.orig/drivers/md/md.c
+++ linux-2.6/drivers/md/md.c
@@ -2890,9 +2890,9 @@ static int analyze_sbs(mddev_t *mddev)
kick_rdev_from_array(rdev);
}

-
- super_types[mddev->major_version].
- validate_super(mddev, freshest);
+ /* If the freshest superblock available cannot be validated, fail. */
+ if (super_types[mddev->major_version].validate_super(mddev, freshest))
+ return -EINVAL;

i = 0;
rdev_for_each(rdev, tmp, mddev) {
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html