All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yang Xu <xuyang2018.jy@fujitsu.com>
To: <fstests@vger.kernel.org>
Cc: Yang Xu <xuyang2018.jy@fujitsu.com>
Subject: [PATCH] common/xfs: Fix _require_scratch_xfs_shrink bug
Date: Fri, 28 May 2021 17:41:10 +0800	[thread overview]
Message-ID: <1622194870-2085-1-git-send-email-xuyang2018.jy@fujitsu.com> (raw)

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 <xuyang2018.jy@fujitsu.com>
---
 common/xfs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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"
-- 
2.27.0


             reply	other threads:[~2021-05-28  9:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-28  9:41 Yang Xu [this message]
2021-05-28 11:58 ` [PATCH] common/xfs: Fix _require_scratch_xfs_shrink bug Gao Xiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1622194870-2085-1-git-send-email-xuyang2018.jy@fujitsu.com \
    --to=xuyang2018.jy@fujitsu.com \
    --cc=fstests@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.