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

raid: resync cannot lose primary leg

Prohibity droping primary leg while resyncing.
This commit is contained in:
Zdenek Kabelac 2021-03-19 01:54:06 +01:00
parent 076e155697
commit cc140f68a5

View File

@ -2945,11 +2945,16 @@ static int _raid_allow_extraction(struct logical_volume *lv,
!lv_raid_dev_health(lv, &dev_health))
return_0;
if (!strcmp("resync", sync_action))
return 1;
if (!strcmp("resync", sync_action)) {
if (!lv_is_on_pvs(seg_lv(seg, 0), target_pvs) &&
!lv_is_on_pvs(seg_metalv(seg, 0), target_pvs))
return 1;
log_error("Unable to remove primary RAID image while array resyncing.");
return 0;
}
/* If anything other than "recover", rebuild or "idle" */
/* Targets reports for a while 'idle' state, before recover starts */
/* Targets reports for a while 'idle' state, before recover starts */
if (strcmp("recover", sync_action) &&
strcmp("rebuild", sync_action) &&
strcmp("idle", sync_action)) {