summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2023-02-23 16:32:37 -0600
committerDavid Teigland <teigland@redhat.com>2023-02-23 16:55:36 -0600
commit1857eb9fe08924c2e4e5adfc322ee4a2ae5a2e67 (patch)
tree8ac5a22a45b545ddda7cc97dc6fefe59bcc4b483 /test
parent86ac529b99d04cb7feb9b52fae3cbeda6144660c (diff)
downloadlvm2-1857eb9fe08924c2e4e5adfc322ee4a2ae5a2e67.tar.gz
lvresize: fix check for mounted and renamed LV to handle spaces
Replace spaces with \040 in directory paths from getmntent (mtab). The recent commit 5374a44c5712 compares mount point directory paths from /etc/mtab and /proc/mounts, in order to detect when a mounted LV has been renamed. The directory path comparison does not work correctly when the path contains spaces because getmntent uses ascii space chars and proc replaces spaces with \040.
Diffstat (limited to 'test')
-rw-r--r--test/shell/lvresize-fs.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/shell/lvresize-fs.sh b/test/shell/lvresize-fs.sh
index f437652d6..de234aad5 100644
--- a/test/shell/lvresize-fs.sh
+++ b/test/shell/lvresize-fs.sh
@@ -30,6 +30,9 @@ which mkfs.xfs || skip
mount_dir="mnt_lvresize_fs"
mkdir -p "$mount_dir"
+mount_dir_space="other mnt dir"
+mkdir -p "$mount_dir_space"
+
# Tests require a libblkid version that shows FSLASTBLOCK
lvcreate -n $lv1 -L 300 $vg
mkfs.xfs -f "$DM_DEV_DIR/$vg/$lv1"
@@ -273,6 +276,17 @@ umount "$mount_dir"
lvchange -an $vg/$lv2
lvremove $vg/$lv2
+# lvextend|lvreduce, ext4, active, mounted, mount dir with space, --fs resize, renamed LV
+lvcreate -n $lv -L 256M $vg
+mkfs.ext4 "$DM_DEV_DIR/$vg/$lv"
+mount "$DM_DEV_DIR/$vg/$lv" "$mount_dir_space"
+lvrename $vg/$lv $vg/$lv2
+not lvextend --fs resize -L+32M $vg/$lv2
+not lvreduce --fs resize -L-32M $vg/$lv2
+umount "$mount_dir_space"
+lvchange -an $vg/$lv2
+lvremove $vg/$lv2
+
#
# lvextend, xfs