From: Yang Xu Date: Fri, 28 May 2021 09:41:10 +0000 (+0800) Subject: common/xfs: Fix _require_scratch_xfs_shrink bug X-Git-Tag: v2022.05.01~385 X-Git-Url: http://git.apps.os.sepia.ceph.com/?p=xfstests-dev.git;a=commitdiff_plain;h=ee7383c5f54c8408ef941fc82a07fb1b8fe0afee;ds=sidebyside common/xfs: Fix _require_scratch_xfs_shrink bug Since local declaration can't pass function return value, this helper never detects whether kernel or xfsprogs supports xfs shrink feature successfully. Fit it by separating declaration and assignment of local variables. Signed-off-by: Yang Xu Reviewed-by: Gao Xiang Signed-off-by: Eryu Guan --- diff --git a/common/xfs b/common/xfs index d7f2a005..c5e39427 100644 --- a/common/xfs +++ b/common/xfs @@ -820,7 +820,8 @@ _require_scratch_xfs_shrink() . $tmp.mkfs _scratch_mount # here just to check if kernel supports, no need do more extra work - local errmsg=$($XFS_GROWFS_PROG -D$((dblocks-1)) "$SCRATCH_MNT" 2>&1) + local errmsg + errmsg=$($XFS_GROWFS_PROG -D$((dblocks-1)) "$SCRATCH_MNT" 2>&1) if [ "$?" -ne 0 ]; then echo "$errmsg" | grep 'XFS_IOC_FSGROWFSDATA xfsctl failed: Invalid argument' > /dev/null && \ _notrun "kernel does not support shrinking"