Commit 9e7d9367 authored by Heinz Mauelshagen's avatar Heinz Mauelshagen Committed by Mike Snitzer

dm raid: support raid0 with missing metadata devices

The raid0 MD personality does not start a raid0 array with any of its
data devices missing.

dm-raid was removing data/metadata device pairs unconditionally if it
failed to read a superblock off the respective metadata device of such
pair, resulting in failure to start arrays with the raid0 personality.

Avoid removing any data/metadata device pairs in case of raid0
(e.g. lvm2 segment type 'raid0_meta') thus allowing MD to start the
array.

Also, avoid region size validation for raid0.
Signed-off-by: default avatarHeinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent a3c06a38
...@@ -860,6 +860,9 @@ static int validate_region_size(struct raid_set *rs, unsigned long region_size) ...@@ -860,6 +860,9 @@ static int validate_region_size(struct raid_set *rs, unsigned long region_size)
{ {
unsigned long min_region_size = rs->ti->len / (1 << 21); unsigned long min_region_size = rs->ti->len / (1 << 21);
if (rs_is_raid0(rs))
return 0;
if (!region_size) { if (!region_size) {
/* /*
* Choose a reasonable default. All figures in sectors. * Choose a reasonable default. All figures in sectors.
...@@ -929,6 +932,8 @@ static int validate_raid_redundancy(struct raid_set *rs) ...@@ -929,6 +932,8 @@ static int validate_raid_redundancy(struct raid_set *rs)
rebuild_cnt++; rebuild_cnt++;
switch (rs->raid_type->level) { switch (rs->raid_type->level) {
case 0:
break;
case 1: case 1:
if (rebuild_cnt >= rs->md.raid_disks) if (rebuild_cnt >= rs->md.raid_disks)
goto too_many; goto too_many;
...@@ -2334,6 +2339,13 @@ static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs) ...@@ -2334,6 +2339,13 @@ static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs)
case 0: case 0:
break; break;
default: default:
/*
* We have to keep any raid0 data/metadata device pairs or
* the MD raid0 personality will fail to start the array.
*/
if (rs_is_raid0(rs))
continue;
dev = container_of(rdev, struct raid_dev, rdev); dev = container_of(rdev, struct raid_dev, rdev);
if (dev->meta_dev) if (dev->meta_dev)
dm_put_device(ti, dev->meta_dev); dm_put_device(ti, dev->meta_dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment