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

Fix "lvconvert -m 0 will always take rimage_0 even if it is out-of-sync"

Bail out in case first rimage is out-of-sync.
Refresh first, i.e. "lvchange --resync $RaidLV",
then retry downgrade to linear after resynchronization.
This commit is contained in:
heinzm 2023-05-05 15:00:49 +02:00
parent 368381fd40
commit d7e922480e

View File

@ -3112,14 +3112,23 @@ static int _raid_remove_images(struct logical_volume *lv, int yes,
{ {
struct dm_list removed_lvs; struct dm_list removed_lvs;
if (!archive(lv->vg)) if (new_count == 1) {
return_0; struct lv_segment *seg = first_seg(lv);
if (seg_is_raid1(seg) && !lv_raid_image_in_sync(seg_lv(seg, 0))) {
log_error("%s is out-of-sync! Please try refreshing first.", display_lvname(lv));
return 0;
}
}
if (!removal_lvs) { if (!removal_lvs) {
dm_list_init(&removed_lvs); dm_list_init(&removed_lvs);
removal_lvs = &removed_lvs; removal_lvs = &removed_lvs;
} }
if (!archive(lv->vg))
return_0;
if (!_raid_extract_images(lv, 0, new_count, allocate_pvs, 1, if (!_raid_extract_images(lv, 0, new_count, allocate_pvs, 1,
removal_lvs, removal_lvs)) { removal_lvs, removal_lvs)) {
log_error("Failed to extract images from %s.", log_error("Failed to extract images from %s.",