Accepting request 906108 from home:hmzhao:branches:openSUSE:Factory
- lvm2: double free or corruption with invalid LVM_SYSTEM_DIR breaks guestfs-tools (bsc#1188141) + bug-1188141_toolcontext-fix-double-free-core-dumped-issue.patch - replace exist patch with bug fixed patches - (remove) fate-31841_fsadm-add-support-for-btrfs.patch + (add) fate-31841-01_fsadm-add-support-to-resize-check-btrfs-filesystem.patch + (add) fate-31841-02_man-add-support-for-btrfs.patch + (add) fate-31841-03_tests-new-test-suite-of-fsadm-for-btrfs.patch OBS-URL: https://build.opensuse.org/request/show/906108 OBS-URL: https://build.opensuse.org/package/show/Base:System/lvm2?expand=0&rev=302
This commit is contained in:
parent
d0810cf04c
commit
e8bec48e22
@ -0,0 +1,62 @@
|
|||||||
|
From db22a389cfb12eef77dfc2e1ce124ac83ed6c5a2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Heming Zhao <heming.zhao@suse.com>
|
||||||
|
Date: Tue, 13 Jul 2021 03:01:00 +0800
|
||||||
|
Subject: [PATCH] toolcontext: fix double free (core dumped) issue
|
||||||
|
|
||||||
|
How to trigger:
|
||||||
|
|
||||||
|
```
|
||||||
|
~ # export LVM_SYSTEM_DIR=_
|
||||||
|
~ # pvscan
|
||||||
|
No matching physical volumes found
|
||||||
|
double free or corruption (!prev)
|
||||||
|
Aborted (core dumped)
|
||||||
|
```
|
||||||
|
|
||||||
|
when LVM_SYSTEM_DIR is empty, _load_config_file() won't be called.
|
||||||
|
|
||||||
|
when LVM_SYSTEM_DIR is not empty, cfl->cft links into cmd->config_files
|
||||||
|
by _load_config_file()@lib/commands/toolcontext.c
|
||||||
|
|
||||||
|
core dumped code: _destroy_config()@lib/commands/toolcontext.c
|
||||||
|
|
||||||
|
```
|
||||||
|
/* CONFIG_FILE/CONFIG_MERGED_FILES */
|
||||||
|
if ((cft = remove_config_tree_by_source(cmd, CONFIG_MERGED_FILES)))
|
||||||
|
config_destroy(cft);
|
||||||
|
else if ((cft = remove_config_tree_by_source(cmd, CONFIG_FILE)))
|
||||||
|
config_destroy(cft); <=== first free the cft
|
||||||
|
|
||||||
|
dm_list_iterate_items(cfl, &cmd->config_files)
|
||||||
|
config_destroy(cfl->cft); <=== double free the cft
|
||||||
|
```
|
||||||
|
|
||||||
|
Fixes: c43f2f8ae08ed0555a300764c8644ea56f4f41e2
|
||||||
|
|
||||||
|
Signed-off-by: Heming Zhao <heming.zhao@suse.com>
|
||||||
|
---
|
||||||
|
lib/commands/toolcontext.c | 7 ++++++-
|
||||||
|
1 file changed, 6 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
|
||||||
|
index b295a20efe52..742bdd9c2311 100644
|
||||||
|
--- a/lib/commands/toolcontext.c
|
||||||
|
+++ b/lib/commands/toolcontext.c
|
||||||
|
@@ -966,8 +966,13 @@ static void _destroy_config(struct cmd_context *cmd)
|
||||||
|
/* CONFIG_FILE/CONFIG_MERGED_FILES */
|
||||||
|
if ((cft = remove_config_tree_by_source(cmd, CONFIG_MERGED_FILES)))
|
||||||
|
config_destroy(cft);
|
||||||
|
- else if ((cft = remove_config_tree_by_source(cmd, CONFIG_FILE)))
|
||||||
|
+ else if ((cft = remove_config_tree_by_source(cmd, CONFIG_FILE))) {
|
||||||
|
+ dm_list_iterate_items(cfl, &cmd->config_files) {
|
||||||
|
+ if (cfl->cft == cft)
|
||||||
|
+ dm_list_del(&cfl->list);
|
||||||
|
+ }
|
||||||
|
config_destroy(cft);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
dm_list_iterate_items(cfl, &cmd->config_files)
|
||||||
|
config_destroy(cfl->cft);
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
@ -1,24 +1,38 @@
|
|||||||
From 0e1c896caaabdf0de38466951ea281f02fe8bb77 Mon Sep 17 00:00:00 2001
|
From 29562a0f53dad77d5d62f5d8b3bf29401d619867 Mon Sep 17 00:00:00 2001
|
||||||
From: Eric Ren <zren@suse.com>
|
From: Heming Zhao <heming.zhao@suse.com>
|
||||||
Date: Thu, 6 Jul 2017 17:42:58 +0800
|
Date: Wed, 30 Jun 2021 18:34:27 +0800
|
||||||
Subject: [PATCH] fsadm: add support for btrfs
|
Subject: [PATCH 1/3] fsadm: add support to resize & check btrfs filesystem
|
||||||
|
To: lvm-devel@redhat.com,
|
||||||
|
zkabelac@redhat.com,
|
||||||
|
teigland@redhat.com
|
||||||
|
|
||||||
Check: mount the device first and then run`btrfs filesystem scrub start
|
resize:
|
||||||
-B` command
|
btrfs volume may spanning across multiple block devices. resize action should
|
||||||
Reisze: find the mount point first and resize the filesystem after get
|
specific subvolume to not to break the filesystem on LV about to get resized
|
||||||
the device id since there are maybe several devices underneath btrfs
|
with lvresize.
|
||||||
|
|
||||||
|
this patch finds the mount point first and resizes the filesystem after
|
||||||
|
getting the device id since there are maybe several devices underneath btrfs
|
||||||
filesystem
|
filesystem
|
||||||
|
|
||||||
---
|
check:
|
||||||
by heming.zhao@suse.com 2021.6.8
|
check the data integrity.
|
||||||
modify patch according to upstream code
|
this patch mounts the device first and then runs `btrfs filesystem scrub
|
||||||
|
start -B` command
|
||||||
|
|
||||||
|
refer legacy patches:
|
||||||
|
- Ondrej Kozina <okozina@redhat.com>
|
||||||
|
https://listman.redhat.com/archives/lvm-devel/2012-November/msg00052.html
|
||||||
|
- Lidong Zhong <lzhong@suse.com>
|
||||||
|
https://listman.redhat.com/archives/lvm-devel/2015-March/msg00053.html
|
||||||
|
|
||||||
|
Signed-off-by: Heming Zhao <heming.zhao@suse.com>
|
||||||
---
|
---
|
||||||
scripts/fsadm.sh | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
|
scripts/fsadm.sh | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
|
||||||
1 file changed, 72 insertions(+), 3 deletions(-)
|
1 file changed, 86 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
diff --git a/scripts/fsadm.sh b/scripts/fsadm.sh
|
diff --git a/scripts/fsadm.sh b/scripts/fsadm.sh
|
||||||
index a09b91534..2a29d5ad5 100755
|
index 9ae422f55edf..a7345c503f77 100755
|
||||||
--- a/scripts/fsadm.sh
|
--- a/scripts/fsadm.sh
|
||||||
+++ b/scripts/fsadm.sh
|
+++ b/scripts/fsadm.sh
|
||||||
@@ -22,6 +22,7 @@
|
@@ -22,6 +22,7 @@
|
||||||
@ -29,7 +43,7 @@ index a09b91534..2a29d5ad5 100755
|
|||||||
#
|
#
|
||||||
# Return values:
|
# Return values:
|
||||||
# 0 success
|
# 0 success
|
||||||
@@ -57,6 +58,7 @@ XFS_CHECK=xfs_check
|
@@ -59,6 +60,7 @@ XFS_CHECK="xfs_check"
|
||||||
# XFS_REPAIR -n is used when XFS_CHECK is not found
|
# XFS_REPAIR -n is used when XFS_CHECK is not found
|
||||||
XFS_REPAIR="xfs_repair"
|
XFS_REPAIR="xfs_repair"
|
||||||
CRYPTSETUP="cryptsetup"
|
CRYPTSETUP="cryptsetup"
|
||||||
@ -37,7 +51,7 @@ index a09b91534..2a29d5ad5 100755
|
|||||||
|
|
||||||
# user may override lvm location by setting LVM_BINARY
|
# user may override lvm location by setting LVM_BINARY
|
||||||
LVM=${LVM_BINARY:-lvm}
|
LVM=${LVM_BINARY:-lvm}
|
||||||
@@ -76,6 +78,9 @@ BLOCKCOUNT=
|
@@ -78,6 +80,9 @@ BLOCKCOUNT=
|
||||||
MOUNTPOINT=
|
MOUNTPOINT=
|
||||||
MOUNTED=
|
MOUNTED=
|
||||||
REMOUNT=
|
REMOUNT=
|
||||||
@ -47,7 +61,7 @@ index a09b91534..2a29d5ad5 100755
|
|||||||
PROCDIR="/proc"
|
PROCDIR="/proc"
|
||||||
PROCMOUNTS="$PROCDIR/mounts"
|
PROCMOUNTS="$PROCDIR/mounts"
|
||||||
PROCSELFMOUNTINFO="$PROCDIR/self/mountinfo"
|
PROCSELFMOUNTINFO="$PROCDIR/self/mountinfo"
|
||||||
@@ -227,6 +232,33 @@ detect_fs() {
|
@@ -237,6 +242,33 @@ detect_fs() {
|
||||||
verbose "\"$FSTYPE\" filesystem found on \"$VOLUME\"."
|
verbose "\"$FSTYPE\" filesystem found on \"$VOLUME\"."
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,13 +95,11 @@ index a09b91534..2a29d5ad5 100755
|
|||||||
|
|
||||||
# Check that passed mounted MAJOR:MINOR is not matching $MAJOR:MINOR of resized $VOLUME
|
# Check that passed mounted MAJOR:MINOR is not matching $MAJOR:MINOR of resized $VOLUME
|
||||||
validate_mounted_major_minor() {
|
validate_mounted_major_minor() {
|
||||||
@@ -354,8 +386,12 @@ detect_mounted_with_proc_mounts() {
|
@@ -365,7 +397,11 @@ detect_mounted_with_proc_mounts() {
|
||||||
|
|
||||||
# check if the given device is already mounted and where
|
# check if the given device is already mounted and where
|
||||||
# FIXME: resolve swap usage and device stacking
|
# FIXME: resolve swap usage and device stacking
|
||||||
-detect_mounted() {
|
detect_mounted() {
|
||||||
- if test -e "$PROCSELFMOUNTINFO"; then
|
- if test -e "$PROCSELFMOUNTINFO"; then
|
||||||
+detect_mounted() {
|
|
||||||
+ if test "$FSTYPE" = "btrfs" ; then
|
+ if test "$FSTYPE" = "btrfs" ; then
|
||||||
+ check_findmnt || error "Need 'findmnt' utility to work with btrfs filesystem"
|
+ check_findmnt || error "Need 'findmnt' utility to work with btrfs filesystem"
|
||||||
+ detect_fs_uuid || verbose "Can't get fs UUID from \"$VOLUME\" volume"
|
+ detect_fs_uuid || verbose "Can't get fs UUID from \"$VOLUME\" volume"
|
||||||
@ -96,7 +108,7 @@ index a09b91534..2a29d5ad5 100755
|
|||||||
detect_mounted_with_proc_self_mountinfo
|
detect_mounted_with_proc_self_mountinfo
|
||||||
elif test -e "$PROCMOUNTS"; then
|
elif test -e "$PROCMOUNTS"; then
|
||||||
detect_mounted_with_proc_mounts
|
detect_mounted_with_proc_mounts
|
||||||
@@ -654,6 +690,32 @@ resize_crypt() {
|
@@ -662,6 +698,47 @@ resize_crypt() {
|
||||||
dry "$CRYPTSETUP" resize "$1" --size $CRYPT_RESIZE_BLOCKS || error "$CRYPTSETUP failed to resize device $1"
|
dry "$CRYPTSETUP" resize "$1" --size $CRYPT_RESIZE_BLOCKS || error "$CRYPTSETUP failed to resize device $1"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,9 +128,24 @@ index a09b91534..2a29d5ad5 100755
|
|||||||
+ verbose "Parsing $BTRFS filesystem show \"$MOUNTPOINT\""
|
+ verbose "Parsing $BTRFS filesystem show \"$MOUNTPOINT\""
|
||||||
+ for i in $(LC_ALL=C "$BTRFS" filesystem show "$MOUNTPOINT"); do
|
+ for i in $(LC_ALL=C "$BTRFS" filesystem show "$MOUNTPOINT"); do
|
||||||
+ case "$i" in
|
+ case "$i" in
|
||||||
+ *"$VOLUME"*) BTRFS_DEVID=${i##*devid};;
|
+ *"$VOLUME") BTRFS_DEVID=${i##*devid};;
|
||||||
+ esac
|
+ esac
|
||||||
+ done
|
+ done
|
||||||
|
+
|
||||||
|
+ # If dev doesn't locate in "/dev", 'btrfs filesystem show' will mistakely
|
||||||
|
+ # report path. Below is a work around to get correct lvm dev path.
|
||||||
|
+ if [ -z "$BTRFS_DEVID" ];then
|
||||||
|
+ for i in $(LC_ALL=C "$BTRFS" filesystem show "$MOUNTPOINT"); do
|
||||||
|
+ case "$i" in
|
||||||
|
+ *" path "*)
|
||||||
|
+ path_str=${i##*path}
|
||||||
|
+ path_str=$(echo $path_str|sed 's/^[ \t]*//g'|sed 's/[ \t]*$'//g)
|
||||||
|
+ result=$(echo $VOLUME | grep -E "${path_str}$")
|
||||||
|
+ test -n "$result" && BTRFS_DEVID=${i##*devid}
|
||||||
|
+ ;;
|
||||||
|
+ esac
|
||||||
|
+ done
|
||||||
|
+ fi
|
||||||
+ BTRFS_DEVID=${BTRFS_DEVID%%size*}
|
+ BTRFS_DEVID=${BTRFS_DEVID%%size*}
|
||||||
+ BTRFS_DEVID=$(echo $BTRFS_DEVID|sed 's/^[ \t]*//g'|sed 's/[ \t]*$'//g)
|
+ BTRFS_DEVID=$(echo $BTRFS_DEVID|sed 's/^[ \t]*//g'|sed 's/[ \t]*$'//g)
|
||||||
+ decode_size $1 1
|
+ decode_size $1 1
|
||||||
@ -129,7 +156,7 @@ index a09b91534..2a29d5ad5 100755
|
|||||||
####################
|
####################
|
||||||
# Resize filesystem
|
# Resize filesystem
|
||||||
####################
|
####################
|
||||||
@@ -676,6 +738,7 @@ resize() {
|
@@ -685,6 +762,7 @@ resize() {
|
||||||
"crypto_LUKS")
|
"crypto_LUKS")
|
||||||
which "$CRYPTSETUP" >"$NULL" 2>&1 || error "$CRYPTSETUP utility required to resize LUKS volume"
|
which "$CRYPTSETUP" >"$NULL" 2>&1 || error "$CRYPTSETUP utility required to resize LUKS volume"
|
||||||
CMD=resize_luks ;;
|
CMD=resize_luks ;;
|
||||||
@ -137,7 +164,7 @@ index a09b91534..2a29d5ad5 100755
|
|||||||
*) error "Filesystem \"$FSTYPE\" on device \"$VOLUME\" is not supported by this tool." ;;
|
*) error "Filesystem \"$FSTYPE\" on device \"$VOLUME\" is not supported by this tool." ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -748,6 +811,12 @@ check() {
|
@@ -762,6 +840,12 @@ check() {
|
||||||
which "$CRYPTSETUP" >"$NULL" 2>&1 || error "$CRYPTSETUP utility required."
|
which "$CRYPTSETUP" >"$NULL" 2>&1 || error "$CRYPTSETUP utility required."
|
||||||
check_luks || error "Crypto luks check failed."
|
check_luks || error "Crypto luks check failed."
|
||||||
;;
|
;;
|
||||||
@ -150,7 +177,7 @@ index a09b91534..2a29d5ad5 100755
|
|||||||
*)
|
*)
|
||||||
error "Filesystem \"$FSTYPE\" on device \"$VOLUME\" is not supported by this tool." ;;
|
error "Filesystem \"$FSTYPE\" on device \"$VOLUME\" is not supported by this tool." ;;
|
||||||
esac
|
esac
|
||||||
@@ -766,7 +835,7 @@ test -n "$FSADM_RUNNING" && exit 0
|
@@ -780,7 +864,7 @@ test -n "${FSADM_RUNNING-}" && exit 0
|
||||||
for i in "$TUNE_EXT" "$RESIZE_EXT" "$TUNE_REISER" "$RESIZE_REISER" \
|
for i in "$TUNE_EXT" "$RESIZE_EXT" "$TUNE_REISER" "$RESIZE_REISER" \
|
||||||
"$TUNE_XFS" "$RESIZE_XFS" "$MOUNT" "$UMOUNT" "$MKDIR" \
|
"$TUNE_XFS" "$RESIZE_XFS" "$MOUNT" "$UMOUNT" "$MKDIR" \
|
||||||
"$RMDIR" "$BLOCKDEV" "$BLKID" "$GREP" "$READLINK" \
|
"$RMDIR" "$BLOCKDEV" "$BLKID" "$GREP" "$READLINK" \
|
||||||
@ -160,5 +187,5 @@ index a09b91534..2a29d5ad5 100755
|
|||||||
done
|
done
|
||||||
|
|
||||||
--
|
--
|
||||||
2.13.6
|
1.8.3.1
|
||||||
|
|
38
fate-31841-02_man-add-support-for-btrfs.patch
Normal file
38
fate-31841-02_man-add-support-for-btrfs.patch
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
From 34c04711e6c2a926b335c746643da7d4b5bba33e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Heming Zhao <heming.zhao@suse.com>
|
||||||
|
Date: Wed, 30 Jun 2021 18:39:10 +0800
|
||||||
|
Subject: [PATCH 2/3] man: add support for btrfs
|
||||||
|
To: lvm-devel@redhat.com,
|
||||||
|
zkabelac@redhat.com,
|
||||||
|
teigland@redhat.com
|
||||||
|
|
||||||
|
Signed-off-by: Heming Zhao <heming.zhao@suse.com>
|
||||||
|
---
|
||||||
|
man/fsadm.8_main | 4 ++++
|
||||||
|
1 file changed, 4 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/man/fsadm.8_main b/man/fsadm.8_main
|
||||||
|
index dfff5bb97021..ad924ac3a304 100644
|
||||||
|
--- a/man/fsadm.8_main
|
||||||
|
+++ b/man/fsadm.8_main
|
||||||
|
@@ -31,6 +31,7 @@ It tries to use the same API for
|
||||||
|
.BR ext2 ,
|
||||||
|
.BR ext3 ,
|
||||||
|
.BR ext4 ,
|
||||||
|
+.BR btrfs ,
|
||||||
|
.BR ReiserFS
|
||||||
|
and
|
||||||
|
.BR XFS
|
||||||
|
@@ -119,6 +120,9 @@ Defaults to "\fI/dev\fP" and must be an absolute path.
|
||||||
|
.BR tune2fs (8),
|
||||||
|
.BR resize2fs (8),
|
||||||
|
.P
|
||||||
|
+.BR btrfs (8),
|
||||||
|
+.BR btrfs-scrub (8),
|
||||||
|
+.P
|
||||||
|
.BR reiserfstune (8),
|
||||||
|
.BR resize_reiserfs (8),
|
||||||
|
.P
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
192
fate-31841-03_tests-new-test-suite-of-fsadm-for-btrfs.patch
Normal file
192
fate-31841-03_tests-new-test-suite-of-fsadm-for-btrfs.patch
Normal file
@ -0,0 +1,192 @@
|
|||||||
|
From 17b99e3950eb4457ab2d063fe3c4c93aeb13894a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Heming Zhao <heming.zhao@suse.com>
|
||||||
|
Date: Wed, 30 Jun 2021 18:41:42 +0800
|
||||||
|
Subject: [PATCH 3/3] tests: new test suite of fsadm for btrfs
|
||||||
|
To: lvm-devel@redhat.com,
|
||||||
|
zkabelac@redhat.com,
|
||||||
|
teigland@redhat.com
|
||||||
|
|
||||||
|
refer legacy patche:
|
||||||
|
- Ondrej Kozina <okozina@redhat.com>
|
||||||
|
https://listman.redhat.com/archives/lvm-devel/2012-November/msg00055.html
|
||||||
|
|
||||||
|
Signed-off-by: Heming Zhao <heming.zhao@suse.com>
|
||||||
|
---
|
||||||
|
test/shell/fsadm-btrfs.sh | 165 ++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 165 insertions(+)
|
||||||
|
create mode 100644 test/shell/fsadm-btrfs.sh
|
||||||
|
|
||||||
|
diff --git a/test/shell/fsadm-btrfs.sh b/test/shell/fsadm-btrfs.sh
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000000..cd83a95ace41
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/test/shell/fsadm-btrfs.sh
|
||||||
|
@@ -0,0 +1,165 @@
|
||||||
|
+#!/usr/bin/env bash
|
||||||
|
+
|
||||||
|
+# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
|
||||||
|
+# This copyrighted material is made available to anyone wishing to use,
|
||||||
|
+# modify, copy, or redistribute it subject to the terms and conditions
|
||||||
|
+# of the GNU General Public License v.2.
|
||||||
|
+#
|
||||||
|
+# You should have received a copy of the GNU General Public License
|
||||||
|
+# along with this program; if not, write to the Free Software Foundation,
|
||||||
|
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
+
|
||||||
|
+test_description='Exercise fsadm btrfs resize'
|
||||||
|
+
|
||||||
|
+. lib/inittest
|
||||||
|
+
|
||||||
|
+aux prepare_vg 1 1024
|
||||||
|
+
|
||||||
|
+# set to "skip" to avoid testing given fs and test warning result
|
||||||
|
+# i.e. check_btrfs=skip
|
||||||
|
+check_btrfs=
|
||||||
|
+
|
||||||
|
+which mkfs.btrfs || check_btrfs=${check_btrfs:-mkfs.btrfs}
|
||||||
|
+which btrfs || check_btrfs=${check_btrfs:-btrfs}
|
||||||
|
+
|
||||||
|
+vg_lv=$vg/$lv1
|
||||||
|
+vg_lv2=$vg/${lv1}bar
|
||||||
|
+vg_lv3=$vg/${lv1}bar2
|
||||||
|
+dev_vg_lv="$DM_DEV_DIR/$vg_lv"
|
||||||
|
+dev_vg_lv2="$DM_DEV_DIR/$vg_lv2"
|
||||||
|
+dev_vg_lv3="$DM_DEV_DIR/$vg_lv3"
|
||||||
|
+mount_dir="mnt"
|
||||||
|
+mount_space_dir="mnt space dir"
|
||||||
|
+# for recursive call
|
||||||
|
+export LVM_BINARY=$(which lvm)
|
||||||
|
+
|
||||||
|
+test ! -d "$mount_dir" && mkdir "$mount_dir"
|
||||||
|
+test ! -d "$mount_space_dir" && mkdir "$mount_space_dir"
|
||||||
|
+
|
||||||
|
+cleanup_mounted_and_teardown()
|
||||||
|
+{
|
||||||
|
+ umount "$mount_dir" || true
|
||||||
|
+ umount "$mount_space_dir" || true
|
||||||
|
+ aux teardown
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+check_missing_btrfs()
|
||||||
|
+{
|
||||||
|
+ eval local t=$check_btrfs
|
||||||
|
+ test -z "$t" && return 0
|
||||||
|
+ test "$t" = skip && return 1
|
||||||
|
+ # trick for warning test
|
||||||
|
+ echo "WARNING: fsadm test skipped btrfs tests, $t tool is missing"
|
||||||
|
+ return 1
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+fscheck_btrfs() {
|
||||||
|
+ btrfsck "$1"
|
||||||
|
+}
|
||||||
|
+scrub_btrfs() {
|
||||||
|
+ btrfs scrub start -B "$1"
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+# btrfs minimal size calculation is complex, we use 64M here.
|
||||||
|
+lvcreate -n $lv1 -L64M $vg
|
||||||
|
+lvcreate -n ${lv1}bar -L64M $vg
|
||||||
|
+lvcreate -n ${lv1}bar2 -L64M $vg
|
||||||
|
+trap 'cleanup_mounted_and_teardown' EXIT
|
||||||
|
+
|
||||||
|
+single_device_test() {
|
||||||
|
+ mkfs.btrfs -m single "$dev_vg_lv"
|
||||||
|
+ mkfs.btrfs -m single "$dev_vg_lv2"
|
||||||
|
+
|
||||||
|
+ # kernel limits 256 MB as minimal btrfs resizable size
|
||||||
|
+ # you can grow fs from 30MB->256MB
|
||||||
|
+ # but you can't grow from 30MB->180MB
|
||||||
|
+ fsadm --lvresize resize $vg_lv 256M
|
||||||
|
+ fsadm --lvresize resize $vg_lv2 256M
|
||||||
|
+
|
||||||
|
+ not fsadm -y --lvresize resize $vg_lv 200M
|
||||||
|
+ lvresize -L+10M -r $vg_lv
|
||||||
|
+ lvreduce -L256M -r $vg_lv
|
||||||
|
+ fscheck_btrfs $dev_vg_lv
|
||||||
|
+
|
||||||
|
+ mount "$dev_vg_lv" "$mount_dir"
|
||||||
|
+ mount "$dev_vg_lv2" "$mount_space_dir"
|
||||||
|
+
|
||||||
|
+ not fsadm -y --lvresize resize $vg_lv 200M
|
||||||
|
+ lvresize -L+10M -r $vg_lv
|
||||||
|
+ lvreduce -L256M -r $vg_lv
|
||||||
|
+ scrub_btrfs $dev_vg_lv
|
||||||
|
+ umount "$mount_dir"
|
||||||
|
+
|
||||||
|
+ not fsadm -y --lvresize resize $vg_lv2 200M
|
||||||
|
+ lvresize -L+10M -r $vg_lv2
|
||||||
|
+ lvreduce -L256M -r $vg_lv2
|
||||||
|
+ scrub_btrfs $dev_vg_lv2
|
||||||
|
+ umount "$mount_space_dir"
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+multiple_devices_test() {
|
||||||
|
+ mkfs.btrfs -m single -d single -f "$dev_vg_lv" "$dev_vg_lv2" "$dev_vg_lv3"
|
||||||
|
+
|
||||||
|
+ fsadm -y --lvresize resize $vg_lv 256M
|
||||||
|
+ fsadm -y --lvresize resize $vg_lv2 256M
|
||||||
|
+ fsadm -y --lvresize resize $vg_lv3 256M
|
||||||
|
+
|
||||||
|
+ # check if fsadm is able to get/resize btrfs on
|
||||||
|
+ # the right device
|
||||||
|
+ lvresize -L+150M $vg_lv
|
||||||
|
+ fsadm -y resize $vg_lv 300M
|
||||||
|
+ # no space to extend, so failed
|
||||||
|
+ not fsadm -y resize $vg_lv2 300M
|
||||||
|
+ not fsadm -y resize $vg_lv3 300M
|
||||||
|
+ lvreduce -y -L256M -r $vg_lv
|
||||||
|
+
|
||||||
|
+ lvresize -L+150M $vg_lv2
|
||||||
|
+ fsadm -y resize $vg_lv2 300M
|
||||||
|
+ not fsadm -y resize $vg_lv3 300M
|
||||||
|
+ not fsadm -y resize $vg_lv 300M
|
||||||
|
+ lvreduce -y -L256M -r $vg_lv2
|
||||||
|
+
|
||||||
|
+ lvresize -L+150M $vg_lv3
|
||||||
|
+ fsadm -y resize $vg_lv3 300M
|
||||||
|
+ not fsadm -y resize $vg_lv2 300M
|
||||||
|
+ not fsadm -y resize $vg_lv 300M
|
||||||
|
+ lvreduce -y -L256M -r $vg_lv3
|
||||||
|
+ fscheck_btrfs $dev_vg_lv
|
||||||
|
+
|
||||||
|
+ # repeat with mounted fs
|
||||||
|
+ mount "$dev_vg_lv" "$mount_dir"
|
||||||
|
+ mount "$dev_vg_lv2" "$mount_space_dir"
|
||||||
|
+
|
||||||
|
+ lvresize -L300M $vg_lv
|
||||||
|
+ fsadm -y resize $vg_lv 300M
|
||||||
|
+ not fsadm -y resize $vg_lv2 300M
|
||||||
|
+ not fsadm -y resize $vg_lv3 300M
|
||||||
|
+ lvreduce -y -L256M -r $vg_lv
|
||||||
|
+
|
||||||
|
+ lvresize -L300M $vg_lv2
|
||||||
|
+ fsadm -y resize $vg_lv2 300M
|
||||||
|
+ not fsadm -y resize $vg_lv3 300M
|
||||||
|
+ not fsadm -y resize $vg_lv 300M
|
||||||
|
+ lvreduce -y -L256M -r $vg_lv2
|
||||||
|
+
|
||||||
|
+ lvresize -L300M $vg_lv3
|
||||||
|
+ fsadm -y resize $vg_lv3 300M
|
||||||
|
+ not fsadm -y resize $vg_lv2 300M
|
||||||
|
+ not fsadm -y resize $vg_lv 300M
|
||||||
|
+ lvreduce -y -L256M -r $vg_lv3
|
||||||
|
+
|
||||||
|
+ scrub_btrfs $dev_vg_lv
|
||||||
|
+ umount "$mount_dir"
|
||||||
|
+ umount "$mount_space_dir"
|
||||||
|
+
|
||||||
|
+ lvresize -nf -L300M $vg_lv
|
||||||
|
+ lvresize -nf -L300M $vg_lv2
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+if check_missing_btrfs; then
|
||||||
|
+
|
||||||
|
+ single_device_test
|
||||||
|
+ multiple_devices_test
|
||||||
|
+fi
|
||||||
|
+
|
||||||
|
+vgremove -ff $vg
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
14
lvm2.changes
14
lvm2.changes
@ -1,5 +1,17 @@
|
|||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Jun 8 03:00:00 UTC 2021 - heming.zhao@suse.com
|
Tue Jul 13 11:35:00 UTC 2021 - heming.zhao@suse.com
|
||||||
|
|
||||||
|
- lvm2: double free or corruption with invalid LVM_SYSTEM_DIR breaks guestfs-tools (bsc#1188141)
|
||||||
|
+ bug-1188141_toolcontext-fix-double-free-core-dumped-issue.patch
|
||||||
|
|
||||||
|
- replace exist patch with bug fixed patches
|
||||||
|
- (remove) fate-31841_fsadm-add-support-for-btrfs.patch
|
||||||
|
+ (add) fate-31841-01_fsadm-add-support-to-resize-check-btrfs-filesystem.patch
|
||||||
|
+ (add) fate-31841-02_man-add-support-for-btrfs.patch
|
||||||
|
+ (add) fate-31841-03_tests-new-test-suite-of-fsadm-for-btrfs.patch
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Jun 8 03:00:00 UTC 2021 - heming.zhao@suse.com
|
||||||
|
|
||||||
- update lvm2 from LVM2.03.10 to LVM2.2.03.12 (bsc#1187010)
|
- update lvm2 from LVM2.03.10 to LVM2.2.03.12 (bsc#1187010)
|
||||||
|
|
||||||
|
16
lvm2.spec
16
lvm2.spec
@ -103,16 +103,19 @@ Patch0038: 0038-backup-automatically-store-data-on-vg_unlock.patch
|
|||||||
Patch0039: 0039-archive-avoid-abuse-of-internal-flag.patch
|
Patch0039: 0039-archive-avoid-abuse-of-internal-flag.patch
|
||||||
Patch0040: 0040-pvck-add-lock_global-before-clean_hint_file.patch
|
Patch0040: 0040-pvck-add-lock_global-before-clean_hint_file.patch
|
||||||
Patch0041: 0041-lvmdevices-add-deviceidtype-option.patch
|
Patch0041: 0041-lvmdevices-add-deviceidtype-option.patch
|
||||||
|
Patch0042: bug-1188141_toolcontext-fix-double-free-core-dumped-issue.patch
|
||||||
|
|
||||||
# SUSE patches: 1000+ for LVM
|
# SUSE patches: 1000+ for LVM
|
||||||
# Never upstream
|
# Never upstream
|
||||||
Patch1001: cmirrord_remove_date_time_from_compilation.patch
|
Patch1001: cmirrord_remove_date_time_from_compilation.patch
|
||||||
Patch1002: fate-309425_display-dm-name-for-lv-name.patch
|
Patch1002: fate-309425_display-dm-name-for-lv-name.patch
|
||||||
Patch1003: fate-31841_fsadm-add-support-for-btrfs.patch
|
Patch1003: bug-935623_dmeventd-fix-dso-name-wrong-compare.patch
|
||||||
Patch1004: bug-935623_dmeventd-fix-dso-name-wrong-compare.patch
|
Patch1004: bug-998893_make_pvscan_service_after_multipathd.patch
|
||||||
Patch1005: bug-998893_make_pvscan_service_after_multipathd.patch
|
Patch1005: bug-1179691_config-set-external_device_info_source-none.patch
|
||||||
Patch1006: bug-1179691_config-set-external_device_info_source-none.patch
|
Patch1006: bug-1184687_Add-nolvm-for-kernel-cmdline.patch
|
||||||
Patch1007: bug-1184687_Add-nolvm-for-kernel-cmdline.patch
|
Patch1007: fate-31841-01_fsadm-add-support-to-resize-check-btrfs-filesystem.patch
|
||||||
|
Patch1008: fate-31841-02_man-add-support-for-btrfs.patch
|
||||||
|
Patch1009: fate-31841-03_tests-new-test-suite-of-fsadm-for-btrfs.patch
|
||||||
# SUSE patches 2000+ for device mapper, udev rules
|
# SUSE patches 2000+ for device mapper, udev rules
|
||||||
Patch2001: bug-1012973_simplify-special-case-for-md-in-69-dm-lvm-metadata.patch
|
Patch2001: bug-1012973_simplify-special-case-for-md-in-69-dm-lvm-metadata.patch
|
||||||
# SUSE patches 3000+ for test code
|
# SUSE patches 3000+ for test code
|
||||||
@ -203,6 +206,7 @@ Volume Manager.
|
|||||||
%patch0039 -p1
|
%patch0039 -p1
|
||||||
%patch0040 -p1
|
%patch0040 -p1
|
||||||
%patch0041 -p1
|
%patch0041 -p1
|
||||||
|
%patch0042 -p1
|
||||||
%patch1001 -p1
|
%patch1001 -p1
|
||||||
%patch1002 -p1
|
%patch1002 -p1
|
||||||
%patch1003 -p1
|
%patch1003 -p1
|
||||||
@ -210,6 +214,8 @@ Volume Manager.
|
|||||||
%patch1005 -p1
|
%patch1005 -p1
|
||||||
%patch1006 -p1
|
%patch1006 -p1
|
||||||
%patch1007 -p1
|
%patch1007 -p1
|
||||||
|
%patch1008 -p1
|
||||||
|
%patch1009 -p1
|
||||||
%patch2001 -p1
|
%patch2001 -p1
|
||||||
%patch3001 -p1
|
%patch3001 -p1
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user