summaryrefslogtreecommitdiff
path: root/lib/metadata/lv_manip.c
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2023-01-30 17:12:11 -0600
committerDavid Teigland <teigland@redhat.com>2023-01-30 17:12:11 -0600
commitd9f8acb65a78c20ac806efaeb7a1e39208e1a443 (patch)
treecadd4d6761c72deb3ba7c83d7e2a01e0458da1c9 /lib/metadata/lv_manip.c
parent5374a44c57127cdd832a675545c1d2bbf0b3751a (diff)
downloadlvm2-d9f8acb65a78c20ac806efaeb7a1e39208e1a443.tar.gz
lvresize: fail early if crypt device is missing
If extending an LV with crypto_LUKS on it, and the crypt device is missing, then fail the command before extending the LV.
Diffstat (limited to 'lib/metadata/lv_manip.c')
-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 fa6393a48..2a4e0e88a 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -6939,6 +6939,10 @@ int lv_resize(struct cmd_context *cmd, struct logical_volume *lv,
log_error("File system not found for --resizefs or --fs options.");
goto out;
}
+ if (!strcmp(fstype, "crypto_LUKS") && !lv_crypt_is_active(cmd, lv_path)) {
+ log_error("LUKS dm-crypt device must be active for fs resize.");
+ goto out;
+ }
/* FS utils will fail if LVs were renamed while mounted. */
if (fs_mount_state_is_misnamed(cmd, lv_top, lv_path, fstype))
goto_out;