main - vdo: check memory only in non critical section
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=773b88e028ab2965a8c...
Commit: 773b88e028ab2965a8c185f5f2147334f8f2bbfd
Parent: f486eb60d5cfb72f084b9e2c02e4dc962f26bb69
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Jan 10 21:12:22 2023 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jan 16 12:37:38 2023 +0100
vdo: check memory only in non critical section
When we are actually resizing VDO device - we need to check size only in
non-critical section - otherwise we are checking
---
lib/vdo/vdo.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/vdo/vdo.c b/lib/vdo/vdo.c
index 9efb424f0..d2d14d146 100644
--- a/lib/vdo/vdo.c
+++ b/lib/vdo/vdo.c
@@ -23,6 +23,7 @@
#include "lib/metadata/metadata.h"
#include "lib/metadata/lv_alloc.h"
#include "lib/metadata/segtype.h"
+#include "lib/mm/memlock.h"
#include "base/memory/zalloc.h"
static const char _vdo_module[] = MODULE_NAME_VDO;
@@ -374,7 +375,8 @@ static int _vdo_pool_add_target_line(struct dev_manager *dm,
return 0;
}
- if (!check_vdo_constrains(cmd, seg->lv->size, seg_lv(seg, 0)->size, &seg->vdo_params))
+ if (!critical_section() &&
+ !check_vdo_constrains(cmd, seg->lv->size, get_vdo_pool_virtual_size(seg), &seg->vdo_params))
return_0;
if (!(vdo_pool_name = dm_build_dm_name(mem, seg->lv->vg->name, seg->lv->name, lv_layer(seg->lv))))
1 year, 3 months
main - lvresize: use standard extent conversion function
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f486eb60d5cfb72f084...
Commit: f486eb60d5cfb72f084b9e2c02e4dc962f26bb69
Parent: bb34ebd4e4facb3a12b799bc0541af798e091459
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Jan 10 18:09:51 2023 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jan 16 12:35:00 2023 +0100
lvresize: use standard extent conversion function
We need to validate whether the requested resizing size can be
expressed with given extent_size.
---
lib/metadata/lv_manip.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index f8eae0447..305be8578 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -5197,7 +5197,8 @@ static int _lvresize_adjust_size(struct volume_group *vg,
display_size(vg->cmd, size));
}
- *extents = size / extent_size;
+ if (!(*extents = extents_from_size(vg->cmd, size, extent_size)))
+ return_0;
return 1;
}
1 year, 3 months
main - fix typo
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=bb34ebd4e4facb3a12b...
Commit: bb34ebd4e4facb3a12b799bc0541af798e091459
Parent: 2ab81a3513f200d16d35b07cc8d510ba5d95c001
Author: lilinjie <lilinjie(a)uniontech.com>
AuthorDate: Wed Jan 4 13:21:13 2023 +0800
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Wed Jan 11 13:52:12 2023 +0100
fix typo
Signed-off-by: lilinjie <lilinjie(a)uniontech.com>
(cherry picked from commit 81b1f5bc3bac0e2e9099b67162da7d1a4995c5f4)
---
WHATS_NEW | 2 +-
lib/metadata/vdo_manip.c | 6 +++---
test/lib/lvm_vdo_wrapper.sh | 2 +-
tools/lvconvert.c | 2 +-
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 172a6a42b..357203a4d 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -196,7 +196,7 @@ Version 2.03.10 - 09th August 2020
Version 2.03.09 - 26th March 2020
=================================
- Fix formating of vdopool (vdo_slab_size_mb was smaller by 2 bits).
+ Fix formatting of vdopool (vdo_slab_size_mb was smaller by 2 bits).
Fix showing of a dm kernel error when uncaching a volume with cachevol.
Version 2.03.08 - 11th February 2020
diff --git a/lib/metadata/vdo_manip.c b/lib/metadata/vdo_manip.c
index 0181dc6d5..b73d40d2c 100644
--- a/lib/metadata/vdo_manip.c
+++ b/lib/metadata/vdo_manip.c
@@ -258,7 +258,7 @@ static int _format_vdo_pool_data_lv(struct logical_volume *data_lv,
};
if (!(dpath = lv_path_dup(data_lv->vg->cmd->mem, data_lv))) {
- log_error("Failed to build device path for VDO formating of data volume %s.",
+ log_error("Failed to build device path for VDO formatting of data volume %s.",
display_lvname(data_lv));
return 0;
}
@@ -425,13 +425,13 @@ struct logical_volume *convert_vdo_pool_lv(struct logical_volume *data_lv,
/* Format data LV as VDO volume */
if (format) {
if (test_mode()) {
- log_verbose("Test mode: Skipping formating of VDO pool volume.");
+ log_verbose("Test mode: Skipping formatting of VDO pool volume.");
} else if (!_format_vdo_pool_data_lv(data_lv, vtp, &vdo_logical_size)) {
log_error("Cannot format VDO pool volume %s.", display_lvname(data_lv));
return NULL;
}
} else {
- log_verbose("Skiping VDO formating %s.", display_lvname(data_lv));
+ log_verbose("Skiping VDO formatting %s.", display_lvname(data_lv));
/* TODO: parse existing VDO data and retrieve vdo_logical_size */
if (!*virtual_extents)
vdo_logical_size = data_lv->size;
diff --git a/test/lib/lvm_vdo_wrapper.sh b/test/lib/lvm_vdo_wrapper.sh
index b1da2e35b..25a6ce0fe 100755
--- a/test/lib/lvm_vdo_wrapper.sh
+++ b/test/lib/lvm_vdo_wrapper.sh
@@ -6,7 +6,7 @@
set -euE -o pipefail
-# tool for formating 'old' VDO metadata format
+# tool for formatting 'old' VDO metadata format
LVM_VDO_FORMAT=${LVM_VDO_FORMAT-"oldvdoformat"}
# tool for shifting VDO metadata header by 2MiB
LVM_VDO_PREPARE=${LVM_VDO_PREPARE-"oldvdoprepareforlvm"}
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 8888cac28..c41d9aaf1 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -5464,7 +5464,7 @@ static int _lvconvert_to_vdopool_single(struct cmd_context *cmd,
vdo_pool_zero = arg_int_value(cmd, zero_ARG, 1);
- log_warn("WARNING: Converting logical volume %s to VDO pool volume %s formating.",
+ log_warn("WARNING: Converting logical volume %s to VDO pool volume %s formatting.",
display_lvname(lv), vdo_pool_zero ? "with" : "WITHOUT");
if (vdo_pool_zero)
1 year, 3 months
main - lvmlockd: Fix syntax error in previous commit
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2ab81a3513f200d16d3...
Commit: 2ab81a3513f200d16d35b07cc8d510ba5d95c001
Parent: 7c9c3ba5d59eef94c846e16d786e3ff4029516e5
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Wed Jan 11 13:34:38 2023 +0100
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Wed Jan 11 13:34:38 2023 +0100
lvmlockd: Fix syntax error in previous commit
---
lib/locking/lvmlockd.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/locking/lvmlockd.h b/lib/locking/lvmlockd.h
index 8628fa093..d486abc09 100644
--- a/lib/locking/lvmlockd.h
+++ b/lib/locking/lvmlockd.h
@@ -260,7 +260,7 @@ static inline int lockd_lv_refresh(struct cmd_context *cmd, struct lvresize_para
return 0;
}
-static inline int lockd_query_lv(struct cmd_context *cmd, struct logical_volume *lv, int *ex, int *sh);
+static inline int lockd_query_lv(struct cmd_context *cmd, struct logical_volume *lv, int *ex, int *sh)
{
return 0;
}
1 year, 3 months
rhel-9.2.0 - lvresize: fix cryptsetup resize in helper
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=db067b9054d87ada6aa...
Commit: db067b9054d87ada6aa133394e65e3af9d75fc08
Parent: 20c6961e37bf6f5010f9d2035dbc1ce03f9b0223
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Jan 3 11:38:33 2023 -0600
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Fri Jan 6 15:38:29 2023 +0100
lvresize: fix cryptsetup resize in helper
typo used "cryptresize" as command name
this affects cases where the file system is resized
independently, and then the lvresize command is used
which only needs to resize the crypt device and the LV.
(cherry picked from commit 81acde7ffdf9fbe522ada16f89e429d9f729dc0c)
---
scripts/lvresize_fs_helper.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/lvresize_fs_helper.sh b/scripts/lvresize_fs_helper.sh
index 031b8453b..f531dd447 100755
--- a/scripts/lvresize_fs_helper.sh
+++ b/scripts/lvresize_fs_helper.sh
@@ -224,7 +224,7 @@ fsreduce() {
cryptresize() {
NEWSIZESECTORS=$(($NEWSIZEBYTES/512))
logmsg "cryptsetup resize ${NEWSIZESECTORS} sectors ${DEVPATH}"
- cryptresize resize --size "$NEWSIZESECTORS" "$DEVPATH"
+ cryptsetup resize --size "$NEWSIZESECTORS" "$DEVPATH"
if [ $? -eq 0 ]; then
logmsg "cryptsetup done"
else
1 year, 3 months
rhel-9.2.0 - lvextend: fix overprovisioning check for thin lvs
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=20c6961e37bf6f5010f...
Commit: 20c6961e37bf6f5010f9d2035dbc1ce03f9b0223
Parent: b01433cdc841133500a0ed4041b9b35838d45e87
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Dec 15 09:57:04 2022 -0600
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Thu Dec 22 12:25:45 2022 +0100
lvextend: fix overprovisioning check for thin lvs
18722dfdf4d3 lvresize: restructure code
mistakenly changed the overprovisioning check from applying
to all lv_is_thin_type lvs to only lv_is_thin_pool lvs, so
it no longer applied when extending thin lvs. The result
was missing warning messages when extending thin lvs.
(cherry picked from commit 4baef0f93f608403b6f2db445e7bf1e80f8f3ee6)
---
lib/metadata/lv_manip.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 4cdbc19a0..f8eae0447 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -7007,9 +7007,10 @@ int lv_resize(struct cmd_context *cmd, struct logical_volume *lv,
if (lv_is_thin_pool(lv_top)) {
if (!update_thin_pool_lv(lv_top, 1))
goto_out;
- if (is_extend)
- thin_pool_check_overprovisioning(lv_top);
}
+ if (lv_is_thin_type(lv_top) && is_extend)
+ thin_pool_check_overprovisioning(lv_top);
+
if (lv_main && lv_is_cow_covering_origin(lv_main)) {
if (!monitor_dev_for_events(cmd, lv_main, 0, 0))
stack;
1 year, 3 months
main - lvmlockd: fix report of lv_active_exclusively for special lv types
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7c9c3ba5d59eef94c84...
Commit: 7c9c3ba5d59eef94c846e16d786e3ff4029516e5
Parent: 789904bd57442f783d50f7076c7f9ee188dbd33b
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Jan 10 15:23:16 2023 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Jan 10 15:37:15 2023 -0600
lvmlockd: fix report of lv_active_exclusively for special lv types
Cover a case missed by the recent commit e0ea0706d
"report: query lvmlockd for lv_active_exclusively"
Fix the lv_active_exclusively value reported for thin LVs.
It's the thin pool that is locked in lvmlockd, and the thin
LV state was mistakenly being queried and not found.
Certain LV types like thin can only be activated exclusively, so
always report lv_active_exclusively true for these when active.
---
lib/locking/lvmlockd.c | 48 ++++++++++++++++++++++++++++++++++++------------
lib/locking/lvmlockd.h | 6 ++----
lib/report/report.c | 13 ++++++-------
3 files changed, 44 insertions(+), 23 deletions(-)
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index 051aa817c..614c95642 100644
--- a/lib/locking/lvmlockd.c
+++ b/lib/locking/lvmlockd.c
@@ -2298,27 +2298,20 @@ int lockd_vg_update(struct volume_group *vg)
return ret;
}
-int lockd_query_lv(struct volume_group *vg, const char *lv_name, char *lv_uuid,
- const char *lock_args, int *ex, int *sh)
+static int _query_lv(struct cmd_context *cmd, struct volume_group *vg,
+ const char *lv_name, char *lv_uuid, const char *lock_args,
+ int *ex, int *sh)
{
daemon_reply reply;
- const char *opts = NULL;
const char *reply_str;
int result;
int ret;
- if (!vg_is_shared(vg))
- return 1;
- if (!_use_lvmlockd)
- return 0;
- if (!_lvmlockd_connected)
- return 0;
-
log_debug("lockd query LV %s/%s", vg->name, lv_name);
reply = _lockd_send("query_lock_lv",
"pid = " FMTd64, (int64_t) getpid(),
- "opts = %s", opts ?: "none",
+ "opts = %s", "none",
"vg_name = %s", vg->name,
"lv_name = %s", lv_name,
"lv_uuid = %s", lv_uuid,
@@ -2354,6 +2347,37 @@ int lockd_query_lv(struct volume_group *vg, const char *lv_name, char *lv_uuid,
return ret;
}
+int lockd_query_lv(struct cmd_context *cmd, struct logical_volume *lv, int *ex, int *sh)
+{
+ struct volume_group *vg = lv->vg;
+ char lv_uuid[64] __attribute__((aligned(8)));
+
+ if (cmd->lockd_lv_disable)
+ return 1;
+ if (!vg_is_shared(vg))
+ return 1;
+ if (!_use_lvmlockd)
+ return 0;
+ if (!_lvmlockd_connected)
+ return 0;
+
+ /* types that cannot be active concurrently will always be ex. */
+ if (lv_is_external_origin(lv) ||
+ lv_is_thin_type(lv) ||
+ lv_is_mirror_type(lv) ||
+ lv_is_raid_type(lv) ||
+ lv_is_vdo_type(lv) ||
+ lv_is_cache_type(lv)) {
+ *ex = 1;
+ return 1;
+ }
+
+ if (!id_write_format(&lv->lvid.id[1], lv_uuid, sizeof(lv_uuid)))
+ return_0;
+
+ return _query_lv(cmd, vg, lv->name, lv_uuid, lv->lock_args, ex, sh);
+}
+
/*
* When this is called directly (as opposed to being called from
* lockd_lv), the caller knows that the LV has a lock.
@@ -2392,7 +2416,7 @@ int lockd_lv_name(struct cmd_context *cmd, struct volume_group *vg,
!strcmp(cmd->name, "lvchange") || !strcmp(cmd->name, "lvconvert")) {
int ex = 0, sh = 0;
- if (!lockd_query_lv(vg, lv_name, lv_uuid, lock_args, &ex, &sh))
+ if (!_query_lv(cmd, vg, lv_name, lv_uuid, lock_args, &ex, &sh))
return 1;
if (sh) {
log_warn("WARNING: shared LV may require refresh on other hosts where it is active.");
diff --git a/lib/locking/lvmlockd.h b/lib/locking/lvmlockd.h
index fcaa0a326..8628fa093 100644
--- a/lib/locking/lvmlockd.h
+++ b/lib/locking/lvmlockd.h
@@ -103,8 +103,7 @@ int lockd_lv_uses_lock(struct logical_volume *lv);
int lockd_lv_refresh(struct cmd_context *cmd, struct lvresize_params *lp);
-int lockd_query_lv(struct volume_group *vg, const char *lv_name, char *lv_uuid,
- const char *lock_args, int *ex, int *sh);
+int lockd_query_lv(struct cmd_context *cmd, struct logical_volume *lv, int *ex, int *sh);
#else /* LVMLOCKD_SUPPORT */
@@ -261,8 +260,7 @@ static inline int lockd_lv_refresh(struct cmd_context *cmd, struct lvresize_para
return 0;
}
-static inline int lockd_query_lv(struct volume_group *vg, const char *lv_name,
- char *lv_uuid, const char *lock_args, int *ex, int *sh)
+static inline int lockd_query_lv(struct cmd_context *cmd, struct logical_volume *lv, int *ex, int *sh);
{
return 0;
}
diff --git a/lib/report/report.c b/lib/report/report.c
index 26d35ba95..a15b7298a 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -3855,21 +3855,20 @@ static int _lvactiveexclusively_disp(struct dm_report *rh, struct dm_pool *mem,
const void *data, void *private)
{
const struct logical_volume *lv = (const struct logical_volume *) data;
- int active_exclusively, _sh = 0;
+ int ex = 0, sh = 0;
if (!activation())
return _binary_undef_disp(rh, mem, field, private);
- active_exclusively = lv_is_active(lv);
+ ex = lv_is_active(lv);
- if (active_exclusively && vg_is_shared(lv->vg)) {
- active_exclusively = 0;
- if (!lockd_query_lv(lv->vg, lv->name, lv_uuid_dup(NULL, lv),
- lv->lock_args, &active_exclusively, &_sh))
+ if (ex && vg_is_shared(lv->vg)) {
+ ex = 0;
+ if (!lockd_query_lv(lv->vg->cmd, (struct logical_volume *)lv, &ex, &sh))
return _binary_undef_disp(rh, mem, field, private);
}
- return _binary_disp(rh, mem, field, active_exclusively, GET_FIRST_RESERVED_NAME(lv_active_exclusively_y), private);
+ return _binary_disp(rh, mem, field, ex, GET_FIRST_RESERVED_NAME(lv_active_exclusively_y), private);
}
static int _lvmergefailed_disp(struct dm_report *rh, struct dm_pool *mem,
1 year, 3 months
main - tests: vgimportclone with incomplete pv list and nomda pv
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=789904bd57442f783d5...
Commit: 789904bd57442f783d50f7076c7f9ee188dbd33b
Parent: c4b898a53eec39bc28b5451e7fde87945303a644
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Jan 5 14:47:49 2023 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Jan 5 14:47:49 2023 -0600
tests: vgimportclone with incomplete pv list and nomda pv
---
test/shell/vgimportclone.sh | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/test/shell/vgimportclone.sh b/test/shell/vgimportclone.sh
index 97d146b9e..e1b9d3832 100644
--- a/test/shell/vgimportclone.sh
+++ b/test/shell/vgimportclone.sh
@@ -14,7 +14,7 @@ SKIP_WITH_LVMPOLLD=1
. lib/inittest
-aux prepare_devs 2
+aux prepare_devs 3
vgcreate $SHARED --metadatasize 128k $vg1 "$dev1"
lvcreate -l100%FREE -n $lv1 $vg1
@@ -85,6 +85,25 @@ vgchange -an $vg1 $vg2
vgremove -ff $vg1 $vg2
+pvremove "$dev1"
+pvremove "$dev2"
+
+# Test vgimportclone with incomplete list of devs, and with nomda PV.
+vgcreate $SHARED --vgmetadatacopies 2 $vg1 "$dev1" "$dev2" "$dev3"
+lvcreate -l1 -an $vg1
+not vgimportclone -n newvgname "$dev1"
+not vgimportclone -n newvgname "$dev2"
+not vgimportclone -n newvgname "$dev3"
+not vgimportclone -n newvgname "$dev1" "$dev2"
+not vgimportclone -n newvgname "$dev1" "$dev3"
+not vgimportclone -n newvgname "$dev2" "$dev3"
+vgimportclone -n ${vg1}new "$dev1" "$dev2" "$dev3"
+lvs ${vg1}new
+vgremove -y ${vg1}new
+pvremove "$dev1"
+pvremove "$dev2"
+pvremove "$dev3"
+
# Verify that if we provide the -n|--basevgname,
# the number suffix is not added unnecessarily.
vgcreate $SHARED --metadatasize 128k A${vg1}B "$dev1"
1 year, 3 months
main - vgimportclone: fix importing PV without metadata
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c4b898a53eec39bc28b...
Commit: c4b898a53eec39bc28b5451e7fde87945303a644
Parent: 2580f007f0aaa3bf22c43295caa2c60c6142494f
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Jan 5 14:28:31 2023 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Jan 5 14:28:31 2023 -0600
vgimportclone: fix importing PV without metadata
If one of the PVs in the VG does not hold metadata, then the
command would fail, thinking that PV was from a different VG.
Also add missing free on that error path.
---
tools/vgimportclone.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/vgimportclone.c b/tools/vgimportclone.c
index 60ef20762..93fa3b18d 100644
--- a/tools/vgimportclone.c
+++ b/tools/vgimportclone.c
@@ -203,7 +203,7 @@ int vgimportclone(struct cmd_context *cmd, int argc, char **argv)
struct device *dev;
struct device_list *devl;
struct dm_list other_devs;
- struct volume_group *vg, *error_vg;
+ struct volume_group *vg, *error_vg = NULL;
const char *vgname;
char base_vgname[NAME_LEN] = { 0 };
char tmp_vgname[NAME_LEN] = { 0 };
@@ -322,7 +322,7 @@ int vgimportclone(struct cmd_context *cmd, int argc, char **argv)
goto out;
}
- if (!(vgname = lvmcache_vgname_from_info(info))) {
+ if (!(vgname = lvmcache_vgname_from_info(info)) || is_orphan_vg(vgname)) {
/* The PV may not have metadata, this will be resolved in
the process_each_vg/vg_read at the end. */
continue;
@@ -503,6 +503,8 @@ retry_name:
}
ret = ECMD_PROCESSED;
out:
+ if (error_vg)
+ release_vg(error_vg);
unlock_devices_file(cmd);
return ret;
}
1 year, 3 months
main - tests: lvresize-fs-crypt using helper only for crypt dev
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2580f007f0aaa3bf22c...
Commit: 2580f007f0aaa3bf22c43295caa2c60c6142494f
Parent: 81acde7ffdf9fbe522ada16f89e429d9f729dc0c
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Jan 3 14:35:26 2023 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Jan 3 14:35:26 2023 -0600
tests: lvresize-fs-crypt using helper only for crypt dev
---
test/shell/lvresize-fs-crypt.sh | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/test/shell/lvresize-fs-crypt.sh b/test/shell/lvresize-fs-crypt.sh
index e7b8b9426..61a6de022 100644
--- a/test/shell/lvresize-fs-crypt.sh
+++ b/test/shell/lvresize-fs-crypt.sh
@@ -135,6 +135,31 @@ cryptsetup close $cr
lvchange -an $vg/$lv
lvremove $vg/$lv
+# lvresize uses helper only for crypt dev resize
+# because the fs was resized separately beforehand
+lvcreate -n $lv -L 456M $vg
+echo 93R4P4pIqAH8 | cryptsetup luksFormat -i1 --type luks1 "$DM_DEV_DIR/$vg/$lv"
+echo 93R4P4pIqAH8 | cryptsetup luksOpen "$DM_DEV_DIR/$vg/$lv" $cr
+mkfs.ext4 /dev/mapper/$cr
+mount /dev/mapper/$cr "$mount_dir"
+dd if=/dev/zero of="$mount_dir/zeros1" bs=1M count=100 conv=fdatasync
+df --output=size "$mount_dir" |tee df1
+# resize only the fs (to 256M), not the crypt dev or LV
+umount "$mount_dir"
+resize2fs /dev/mapper/$cr 262144k
+mount /dev/mapper/$cr "$mount_dir"
+# this lvresize will not resize the fs (which is already reduced
+# to smaller than the requested LV size), but lvresize will use
+# the helper to resize the crypt dev before resizing the LV.
+lvresize -L-100M $vg/$lv
+check lv_field $vg/$lv lv_size "356.00m"
+df --output=size "$mount_dir" |tee df2
+not diff df1 df2
+umount "$mount_dir"
+cryptsetup close $cr
+lvchange -an $vg/$lv
+lvremove $vg/$lv
+
# test with LUKS2?
vgremove -ff $vg
1 year, 4 months