1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

lvconvert: fix "lvconvert -m 0" for in-sync legs

With commit d7e922480e
lvconvert -m   may fail if we try to remove 1st. leg that
is out-of-sync while other leg is in-sync.

Hot fix allows to proceed with such down conversion.

Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com>
This commit is contained in:
Heinz Mauelshagen 2023-10-19 16:50:01 +02:00 committed by Zdenek Kabelac
parent 2b01af3de9
commit e41da923a3

View File

@ -3113,9 +3113,26 @@ static int _raid_remove_images(struct logical_volume *lv, int yes,
struct dm_list removed_lvs; struct dm_list removed_lvs;
if (new_count == 1) { if (new_count == 1) {
uint32_t s;
struct lv_segment *seg = first_seg(lv); struct lv_segment *seg = first_seg(lv);
if (seg_is_raid1(seg) && !lv_raid_image_in_sync(seg_lv(seg, 0))) { if (!seg_is_raid1(seg)) {
log_error("%s called on non-raid1 LV.", display_lvname(lv));
return 0;
}
for (s = 0; s < seg->area_count; s++) {
if (seg_type(seg, s) == AREA_UNASSIGNED)
continue;
if (lv_raid_image_in_sync(seg_lv(seg, s))) {
_swap_areas(seg->areas + 0, seg->areas + s);
break;
}
}
if (s >= seg->area_count) {
log_error("%s is out-of-sync! Please try refreshing first.", display_lvname(lv)); log_error("%s is out-of-sync! Please try refreshing first.", display_lvname(lv));
return 0; return 0;
} }