Commit 6995f0b2 authored by Shaohua Li's avatar Shaohua Li

md: takeover should clear unrelated bits

When we change level from raid1 to raid5, the MD_FAILFAST_SUPPORTED bit
will be accidentally set, but raid5 doesn't support it. The same is true
for the MD_HAS_JOURNAL bit.

Fix: 46533ff7 (md: Use REQ_FAILFAST_* on metadata writes where appropriate)
Reviewed-by: default avatarNeilBrown <neilb@suse.com>
Signed-off-by: default avatarShaohua Li <shli@fb.com>
parent 3c6edc66
...@@ -539,8 +539,11 @@ static void *raid0_takeover_raid45(struct mddev *mddev) ...@@ -539,8 +539,11 @@ static void *raid0_takeover_raid45(struct mddev *mddev)
mddev->delta_disks = -1; mddev->delta_disks = -1;
/* make sure it will be not marked as dirty */ /* make sure it will be not marked as dirty */
mddev->recovery_cp = MaxSector; mddev->recovery_cp = MaxSector;
clear_bit(MD_HAS_JOURNAL, &mddev->flags);
clear_bit(MD_JOURNAL_CLEAN, &mddev->flags);
create_strip_zones(mddev, &priv_conf); create_strip_zones(mddev, &priv_conf);
return priv_conf; return priv_conf;
} }
...@@ -580,6 +583,7 @@ static void *raid0_takeover_raid10(struct mddev *mddev) ...@@ -580,6 +583,7 @@ static void *raid0_takeover_raid10(struct mddev *mddev)
mddev->degraded = 0; mddev->degraded = 0;
/* make sure it will be not marked as dirty */ /* make sure it will be not marked as dirty */
mddev->recovery_cp = MaxSector; mddev->recovery_cp = MaxSector;
clear_bit(MD_FAILFAST_SUPPORTED, &mddev->flags);
create_strip_zones(mddev, &priv_conf); create_strip_zones(mddev, &priv_conf);
return priv_conf; return priv_conf;
...@@ -622,6 +626,7 @@ static void *raid0_takeover_raid1(struct mddev *mddev) ...@@ -622,6 +626,7 @@ static void *raid0_takeover_raid1(struct mddev *mddev)
mddev->raid_disks = 1; mddev->raid_disks = 1;
/* make sure it will be not marked as dirty */ /* make sure it will be not marked as dirty */
mddev->recovery_cp = MaxSector; mddev->recovery_cp = MaxSector;
clear_bit(MD_FAILFAST_SUPPORTED, &mddev->flags);
create_strip_zones(mddev, &priv_conf); create_strip_zones(mddev, &priv_conf);
return priv_conf; return priv_conf;
......
...@@ -3243,9 +3243,12 @@ static void *raid1_takeover(struct mddev *mddev) ...@@ -3243,9 +3243,12 @@ static void *raid1_takeover(struct mddev *mddev)
mddev->new_layout = 0; mddev->new_layout = 0;
mddev->new_chunk_sectors = 0; mddev->new_chunk_sectors = 0;
conf = setup_conf(mddev); conf = setup_conf(mddev);
if (!IS_ERR(conf)) if (!IS_ERR(conf)) {
/* Array must appear to be quiesced */ /* Array must appear to be quiesced */
conf->array_frozen = 1; conf->array_frozen = 1;
clear_bit(MD_HAS_JOURNAL, &mddev->flags);
clear_bit(MD_JOURNAL_CLEAN, &mddev->flags);
}
return conf; return conf;
} }
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
......
...@@ -7811,6 +7811,7 @@ static void *raid45_takeover_raid0(struct mddev *mddev, int level) ...@@ -7811,6 +7811,7 @@ static void *raid45_takeover_raid0(struct mddev *mddev, int level)
static void *raid5_takeover_raid1(struct mddev *mddev) static void *raid5_takeover_raid1(struct mddev *mddev)
{ {
int chunksect; int chunksect;
void *ret;
if (mddev->raid_disks != 2 || if (mddev->raid_disks != 2 ||
mddev->degraded > 1) mddev->degraded > 1)
...@@ -7832,7 +7833,10 @@ static void *raid5_takeover_raid1(struct mddev *mddev) ...@@ -7832,7 +7833,10 @@ static void *raid5_takeover_raid1(struct mddev *mddev)
mddev->new_layout = ALGORITHM_LEFT_SYMMETRIC; mddev->new_layout = ALGORITHM_LEFT_SYMMETRIC;
mddev->new_chunk_sectors = chunksect; mddev->new_chunk_sectors = chunksect;
return setup_conf(mddev); ret = setup_conf(mddev);
if (!IS_ERR_VALUE(ret))
clear_bit(MD_FAILFAST_SUPPORTED, &mddev->flags);
return ret;
} }
static void *raid5_takeover_raid6(struct mddev *mddev) static void *raid5_takeover_raid6(struct mddev *mddev)
......
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