1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-10 16:58:47 +03:00

lvconvert: thin convert locking

Fix locking when converting thick to thin LV, ensure
we take pool lock for shared VG.
This commit is contained in:
Zdenek Kabelac 2023-07-14 16:50:27 +02:00
parent bdcfd2d730
commit 8eb3a5b557

View File

@ -3398,6 +3398,7 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
* data and meta LVs (they are unlocked and deleted below.) * data and meta LVs (they are unlocked and deleted below.)
*/ */
if (vg_is_shared(vg)) { if (vg_is_shared(vg)) {
lv->lock_args = NULL;
pool_lv->lock_args = NULL; pool_lv->lock_args = NULL;
data_lv->lock_args = NULL; data_lv->lock_args = NULL;
metadata_lv->lock_args = NULL; metadata_lv->lock_args = NULL;
@ -3455,6 +3456,10 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
goto_bad; goto_bad;
if (to_thin) { if (to_thin) {
if (!lockd_lv(cmd, pool_lv, "ex", LDLV_PERSISTENT)) {
log_error("Failed to lock pool LV %s.", display_lvname(pool_lv));
goto out;
}
if (!lv_update_and_reload(lv)) if (!lv_update_and_reload(lv))
goto_bad; goto_bad;
} else { } else {