aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/raid1.c7
-rw-r--r--drivers/md/raid10.c8
-rw-r--r--drivers/md/raid5.c7
3 files changed, 22 insertions, 0 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 3cbf0ac2aaad..8db311d7cddc 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)
1055 if (mddev->recovery_disabled == conf->recovery_disabled) 1055 if (mddev->recovery_disabled == conf->recovery_disabled)
1056 return -EBUSY; 1056 return -EBUSY;
1057 1057
1058 if (rdev->badblocks.count)
1059 return -EINVAL;
1060
1058 if (rdev->raid_disk >= 0) 1061 if (rdev->raid_disk >= 0)
1059 first = last = rdev->raid_disk; 1062 first = last = rdev->raid_disk;
1060 1063
@@ -1994,6 +1997,10 @@ static int run(mddev_t *mddev)
1994 blk_queue_segment_boundary(mddev->queue, 1997 blk_queue_segment_boundary(mddev->queue,
1995 PAGE_CACHE_SIZE - 1); 1998 PAGE_CACHE_SIZE - 1);
1996 } 1999 }
2000 if (rdev->badblocks.count) {
2001 printk(KERN_ERR "md/raid1: Cannot handle bad blocks yet\n");
2002 return -EINVAL;
2003 }
1997 } 2004 }
1998 2005
1999 mddev->degraded = 0; 2006 mddev->degraded = 0;
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 5def27c28be7..8aadd2f52dc8 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -1101,6 +1101,9 @@ static int raid10_add_disk(mddev_t *mddev, mdk_rdev_t *rdev)
1101 int first = 0; 1101 int first = 0;
1102 int last = conf->raid_disks - 1; 1102 int last = conf->raid_disks - 1;
1103 1103
1104 if (rdev->badblocks.count)
1105 return -EINVAL;
1106
1104 if (mddev->recovery_cp < MaxSector) 1107 if (mddev->recovery_cp < MaxSector)
1105 /* only hot-add to in-sync arrays, as recovery is 1108 /* only hot-add to in-sync arrays, as recovery is
1106 * very different from resync 1109 * very different from resync
@@ -2263,6 +2266,11 @@ static int run(mddev_t *mddev)
2263 (conf->raid_disks / conf->near_copies)); 2266 (conf->raid_disks / conf->near_copies));
2264 2267
2265 list_for_each_entry(rdev, &mddev->disks, same_set) { 2268 list_for_each_entry(rdev, &mddev->disks, same_set) {
2269
2270 if (rdev->badblocks.count) {
2271 printk(KERN_ERR "md/raid10: cannot handle bad blocks yet\n");
2272 goto out_free_conf;
2273 }
2266 disk_idx = rdev->raid_disk; 2274 disk_idx = rdev->raid_disk;
2267 if (disk_idx >= conf->raid_disks 2275 if (disk_idx >= conf->raid_disks
2268 || disk_idx < 0) 2276 || disk_idx < 0)
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index b874f42694e2..719445004dd9 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -4667,6 +4667,10 @@ static int run(mddev_t *mddev)
4667 * 0 for a fully functional array, 1 or 2 for a degraded array. 4667 * 0 for a fully functional array, 1 or 2 for a degraded array.
4668 */ 4668 */
4669 list_for_each_entry(rdev, &mddev->disks, same_set) { 4669 list_for_each_entry(rdev, &mddev->disks, same_set) {
4670 if (rdev->badblocks.count) {
4671 printk(KERN_ERR "md/raid5: cannot handle bad blocks yet\n");
4672 goto abort;
4673 }
4670 if (rdev->raid_disk < 0) 4674 if (rdev->raid_disk < 0)
4671 continue; 4675 continue;
4672 if (test_bit(In_sync, &rdev->flags)) { 4676 if (test_bit(In_sync, &rdev->flags)) {
@@ -4975,6 +4979,9 @@ static int raid5_add_disk(mddev_t *mddev, mdk_rdev_t *rdev)
4975 int first = 0; 4979 int first = 0;
4976 int last = conf->raid_disks - 1; 4980 int last = conf->raid_disks - 1;
4977 4981
4982 if (rdev->badblocks.count)
4983 return -EINVAL;
4984
4978 if (has_failed(conf)) 4985 if (has_failed(conf))
4979 /* no point adding a device */ 4986 /* no point adding a device */
4980 return -EINVAL; 4987 return -EINVAL;