aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2013-04-23 21:42:44 -0400
committerNeilBrown <neilb@suse.de>2013-04-30 00:49:32 -0400
commit486adf72ccc0c235754923d47a2270c5dcb0c98b (patch)
treec90d17b5b5e776da04d6a8b106a4ff3890992f3c
parent0fea7ed82b1edf384735a2b535368f54a8584c3a (diff)
md: bad block list should default to disabled.
Maintenance of a bad-block-list currently defaults to 'enabled' and is then disabled when it cannot be supported. This is backwards and causes problem for dm-raid which didn't know to disable it. So fix the defaults, and only enabled for v1.x metadata which explicitly has bad blocks enabled. The problem with dm-raid has been present since badblock support was added in v3.1, so this patch is suitable for any -stable from 3.1 onwards. Cc: stable@vger.kernel.org (3.1+) Reported-by: Jonathan Brassow <jbrassow@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r--drivers/md/md.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 0df1b9a3d48e..4c74424c78b0 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1567,8 +1567,8 @@ static int super_1_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor_
1567 sector, count, 1) == 0) 1567 sector, count, 1) == 0)
1568 return -EINVAL; 1568 return -EINVAL;
1569 } 1569 }
1570 } else if (sb->bblog_offset == 0) 1570 } else if (sb->bblog_offset != 0)
1571 rdev->badblocks.shift = -1; 1571 rdev->badblocks.shift = 0;
1572 1572
1573 if (!refdev) { 1573 if (!refdev) {
1574 ret = 1; 1574 ret = 1;
@@ -3227,7 +3227,7 @@ int md_rdev_init(struct md_rdev *rdev)
3227 * be used - I wonder if that matters 3227 * be used - I wonder if that matters
3228 */ 3228 */
3229 rdev->badblocks.count = 0; 3229 rdev->badblocks.count = 0;
3230 rdev->badblocks.shift = 0; 3230 rdev->badblocks.shift = -1; /* disabled until explicitly enabled */
3231 rdev->badblocks.page = kmalloc(PAGE_SIZE, GFP_KERNEL); 3231 rdev->badblocks.page = kmalloc(PAGE_SIZE, GFP_KERNEL);
3232 seqlock_init(&rdev->badblocks.lock); 3232 seqlock_init(&rdev->badblocks.lock);
3233 if (rdev->badblocks.page == NULL) 3233 if (rdev->badblocks.page == NULL)
@@ -3299,9 +3299,6 @@ static struct md_rdev *md_import_device(dev_t newdev, int super_format, int supe
3299 goto abort_free; 3299 goto abort_free;
3300 } 3300 }
3301 } 3301 }
3302 if (super_format == -1)
3303 /* hot-add for 0.90, or non-persistent: so no badblocks */
3304 rdev->badblocks.shift = -1;
3305 3302
3306 return rdev; 3303 return rdev;
3307 3304