aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid5.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2011-07-27 21:31:47 -0400
committerNeilBrown <neilb@suse.de>2011-07-27 21:31:47 -0400
commit34b343cff4354ab9864be83be88405fd53d928a0 (patch)
tree10d75ecac6091f955cbb8a60b79f443355ca4ea8 /drivers/md/raid5.c
parent6e0d2d0312fb20c1edac1b2c849068c1c7944abf (diff)
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 <neilb@suse.de> Reviewed-by: Namhyung Kim <namhyung@gmail.com>
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r--drivers/md/raid5.c7
1 files changed, 7 insertions, 0 deletions
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;