From 34b343cff4354ab9864be83be88405fd53d928a0 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Thu, 28 Jul 2011 11:31:47 +1000 Subject: md: don't allow arrays to contain devices with bad blocks. As no personality understand bad block lists yet, we must reject any device that is known to contain bad blocks. As the personalities get taught, these tests can be removed. This only applies to raid1/raid5/raid10. For linear/raid0/multipath/faulty the whole concept of bad blocks doesn't mean anything so there is no point adding the checks. Signed-off-by: NeilBrown Reviewed-by: Namhyung Kim --- drivers/md/raid1.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'drivers/md/raid1.c') diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 3cbf0ac..8db311d 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -1055,6 +1055,9 @@ static int raid1_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) if (mddev->recovery_disabled == conf->recovery_disabled) return -EBUSY; + if (rdev->badblocks.count) + return -EINVAL; + if (rdev->raid_disk >= 0) first = last = rdev->raid_disk; @@ -1994,6 +1997,10 @@ static int run(mddev_t *mddev) blk_queue_segment_boundary(mddev->queue, PAGE_CACHE_SIZE - 1); } + if (rdev->badblocks.count) { + printk(KERN_ERR "md/raid1: Cannot handle bad blocks yet\n"); + return -EINVAL; + } } mddev->degraded = 0; -- cgit v1.1