Skip to content

Commit 9e7d936

Browse files
mauelshasnitm
authored andcommitted
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: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
1 parent a3c06a3 commit 9e7d936

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

drivers/md/dm-raid.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,9 @@ static int validate_region_size(struct raid_set *rs, unsigned long region_size)
860860
{
861861
unsigned long min_region_size = rs->ti->len / (1 << 21);
862862

863+
if (rs_is_raid0(rs))
864+
return 0;
865+
863866
if (!region_size) {
864867
/*
865868
* Choose a reasonable default. All figures in sectors.
@@ -929,6 +932,8 @@ static int validate_raid_redundancy(struct raid_set *rs)
929932
rebuild_cnt++;
930933

931934
switch (rs->raid_type->level) {
935+
case 0:
936+
break;
932937
case 1:
933938
if (rebuild_cnt >= rs->md.raid_disks)
934939
goto too_many;
@@ -2334,6 +2339,13 @@ static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs)
23342339
case 0:
23352340
break;
23362341
default:
2342+
/*
2343+
* We have to keep any raid0 data/metadata device pairs or
2344+
* the MD raid0 personality will fail to start the array.
2345+
*/
2346+
if (rs_is_raid0(rs))
2347+
continue;
2348+
23372349
dev = container_of(rdev, struct raid_dev, rdev);
23382350
if (dev->meta_dev)
23392351
dm_put_device(ti, dev->meta_dev);

0 commit comments

Comments
 (0)