mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-22 17:35:59 +03:00
raid: reject conversion request to striped/raid0 on 2-legged raid4/5
raid4/5 LVs may only be converted to striped or raid0/raid0_meta in case they have at least 3 legs. 2-legged raid4/5 are a result of either converting a raid1 to raid4/5 (takeover) or converting a raid4/5 with more than 2 legs to raid1 with 2 legs (reshape). The raid4/5 personalities map those as raid1, thus reject conversion to striped/raid0. Resolves: rhbz1511047
This commit is contained in:
parent
b78add3df5
commit
763db8aab0
@ -5163,8 +5163,8 @@ static int _takeover_downconvert_wrapper(TAKEOVER_FN_ARGS)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (seg_is_any_raid5(seg) &&
|
if (seg_is_raid4(seg) || seg_is_any_raid5(seg)) {
|
||||||
segtype_is_raid1(new_segtype)) {
|
if (segtype_is_raid1(new_segtype)) {
|
||||||
if (seg->area_count != 2) {
|
if (seg->area_count != 2) {
|
||||||
log_error("Can't convert %s LV %s to %s with != 2 legs.",
|
log_error("Can't convert %s LV %s to %s with != 2 legs.",
|
||||||
lvseg_name(seg), display_lvname(lv), new_segtype->name);
|
lvseg_name(seg), display_lvname(lv), new_segtype->name);
|
||||||
@ -5177,6 +5177,14 @@ static int _takeover_downconvert_wrapper(TAKEOVER_FN_ARGS)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((segtype_is_striped_target(new_segtype) || segtype_is_any_raid0(new_segtype)) &&
|
||||||
|
seg->area_count < 3) {
|
||||||
|
log_error("Can't convert %s LV %s to %s with < 3 legs.",
|
||||||
|
lvseg_name(seg), display_lvname(lv), new_segtype->name);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (seg->area_count > 2) {
|
if (seg->area_count > 2) {
|
||||||
if (dm_snprintf(res_str, sizeof(res_str), " losing %s resilience",
|
if (dm_snprintf(res_str, sizeof(res_str), " losing %s resilience",
|
||||||
segtype_is_striped(new_segtype) ? "all" : "some") < 0)
|
segtype_is_striped(new_segtype) ? "all" : "some") < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user