diff --git a/WHATS_NEW b/WHATS_NEW index 3b3e414e5..19f1d2af3 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.113 - ===================================== + Validate converted volume and specified pool volume differ. Fix regression in vgscan --mknodes usage (2.02.112). Respect --prefix when setting CLMVD_PATH configure (2.02.89). Default to configure --enable-udev-systemd-background-jobs for systemd>=205. diff --git a/test/shell/lvconvert-thin.sh b/test/shell/lvconvert-thin.sh index e61e4709c..74484b1ed 100644 --- a/test/shell/lvconvert-thin.sh +++ b/test/shell/lvconvert-thin.sh @@ -103,6 +103,9 @@ invalid lvconvert -c -256 --thinpool $vg/$lv1 --poolmetadata $vg/$lv2 # non multiple of 64KiB fails invalid lvconvert -c 88 --thinpool $vg/$lv1 --poolmetadata $vg/$lv2 +# cannot use same LV for pool and convertion +fail lvconvert --yes --thinpool $vg/$lv3 -T $vg/$lv3 + # Warning about smaller then suggested lvconvert --yes -c 256 --thinpool $vg/$lv1 --poolmetadata $vg/$lv2 |& tee err grep "WARNING: Chunk size is smaller" err diff --git a/tools/lvconvert.c b/tools/lvconvert.c index d4f3db1ce..8436c24fd 100644 --- a/tools/lvconvert.c +++ b/tools/lvconvert.c @@ -2784,10 +2784,17 @@ static int _lvconvert_pool(struct cmd_context *cmd, char metadata_name[NAME_LEN], data_name[NAME_LEN]; int activate_pool; - if (lp->pool_data_name && - !(pool_lv = find_lv(vg, lp->pool_data_name))) { - log_error("Unknown pool data LV %s.", lp->pool_data_name); - return 0; + if (lp->pool_data_name) { + if ((lp->thin || lp->cache) && + !strcmp(lp->pool_data_name, pool_lv->name)) { + log_error("Converted volume %s and pool volume must differ.", + display_lvname(pool_lv)); + return 0; + } + if (!(pool_lv = find_lv(vg, lp->pool_data_name))) { + log_error("Unknown pool data LV %s.", lp->pool_data_name); + return 0; + } } if (!lv_is_visible(pool_lv)) {