summaryrefslogtreecommitdiff
path: root/lib/metadata
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2022-10-11 11:50:47 -0500
committerDavid Teigland <teigland@redhat.com>2022-10-11 12:48:31 -0500
commitf6f2737015746b1b6c7fbd0d297a4596c584749b (patch)
tree295649dba582bed097f0ea3836c3232cdd9f171c /lib/metadata
parentfc52e87f06959f542ea78b75df104bc6c85fd973 (diff)
downloadlvm2-f6f2737015746b1b6c7fbd0d297a4596c584749b.tar.gz
lvreduce: require active LV when no fs option is used
Without an --fs option set, make lvreduce of an inactive LV fail and report that the LV must be active.
Diffstat (limited to 'lib/metadata')
-rw-r--r--lib/metadata/lv_manip.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index d6452e849..db97a019c 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -6873,6 +6873,10 @@ int lv_resize(struct cmd_context *cmd, struct logical_volume *lv,
is_active = lv_is_active(lv_top);
if (is_reduce && !is_active && !strcmp(lp->fsopt, "checksize")) {
+ if (!lp->user_set_fs) {
+ log_error("The LV must be active to safely reduce, or use --fs checksize.");
+ goto out;
+ }
lv_top->status |= LV_TEMPORARY;
if (!activate_lv(cmd, lv_top)) {
log_error("Failed to activate %s to check for fs.", display_lvname(lv_top));