summaryrefslogtreecommitdiff
path: root/test/shell
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2023-01-19 11:36:51 -0600
committerDavid Teigland <teigland@redhat.com>2023-01-19 11:52:14 -0600
commit3bb55765286dc8e4f0000957d85a6b8ee2752852 (patch)
treec8491f88de7d9435988ea92ae5b7e02211e1f9cc /test/shell
parent92199ad0b98586182a52e2f8cd82c06336e306f1 (diff)
downloadlvm2-3bb55765286dc8e4f0000957d85a6b8ee2752852.tar.gz
lvresize: only resize crypt when fs resize is enabled
There were a couple of cases where lvresize, without --fs resize, was resizing the crypt layer above the LV. Resizing the crypt layer should only be done when fs resizing is enabled (even if the fs is already small enough due to being independently reduced.) Also, check the size of the crypt device to see if it's already been reduced independently, and skip the cryptsetup resize if it's not needed.
Diffstat (limited to 'test/shell')
-rw-r--r--test/shell/lvresize-fs-crypt.sh7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/shell/lvresize-fs-crypt.sh b/test/shell/lvresize-fs-crypt.sh
index 61a6de022..4bef771dc 100644
--- a/test/shell/lvresize-fs-crypt.sh
+++ b/test/shell/lvresize-fs-crypt.sh
@@ -151,7 +151,12 @@ 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
+# Using --fs resize is required to allow lvresize to look above
+# the lv at crypt&fs layers for potential resizing. Without
+# --fs resize, lvresize fails because it sees that crypt resize
+# is needed and --fs resize is needed to enable that.
+not lvresize -L-100 $vg/$lv
+lvresize -L-100M --fs resize $vg/$lv
check lv_field $vg/$lv lv_size "356.00m"
df --output=size "$mount_dir" |tee df2
not diff df1 df2