public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Eryu Guan <guaneryu@gmail.com>
Cc: david@fromorbit.com, fstests <fstests@vger.kernel.org>
Subject: [PATCH] common/xfs: fix various problems with _supports_xfs_scrub
Date: Wed, 21 Mar 2018 19:48:09 -0700	[thread overview]
Message-ID: <20180322024809.GD4810@magnolia> (raw)
In-Reply-To: <20180321165716.GB4818@magnolia>

From: Darrick J. Wong <darrick.wong@oracle.com>

The _supports_xfs_scrub helper is called with a mountpoint (a working
mountpoint is required for scrub) and a block device (used to detect
norecovery mounts).  If either of these conditions aren't satisfied we
should return failure status to the caller, not unilaterally decide to
bail out of the test.  In particular, the -b test doesn't work if the
fs has already shutdown on us.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/xfs |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/common/xfs b/common/xfs
index 1d98ba1..3b71e02 100644
--- a/common/xfs
+++ b/common/xfs
@@ -305,9 +305,13 @@ _supports_xfs_scrub()
 	local mountpoint="$1"
 	local device="$2"
 
-	if [ ! -b "$device" ] || [ ! -e "$mountpoint" ]; then
+	if [ -z "$device" ] || [ -z "$mountpoint" ]; then
 		echo "Usage: _supports_xfs_scrub mountpoint device"
-		exit 1
+		return 1
+	fi
+
+	if [ ! -b "$device" ] || [ ! -e "$mountpoint" ]; then
+		return 1
 	fi
 
 	test "$FSTYP" = "xfs" || return 1

  parent reply	other threads:[~2018-03-22  2:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-21 16:57 [PATCH v3] xfs: test agfl reset on bad list wrapping Darrick J. Wong
2018-03-22  2:46 ` [PATCH] common/xfs: don't call xfs_scrub on a block device Darrick J. Wong
2018-03-29 10:25   ` Xiao Yang
2018-03-29 15:46     ` Darrick J. Wong
2018-03-22  2:48 ` Darrick J. Wong [this message]
2018-03-23  5:26 ` [PATCH v3] xfs: test agfl reset on bad list wrapping Eryu Guan
2018-03-23 16:08   ` Darrick J. Wong
2018-03-26  1:22     ` Eryu Guan
2018-03-28  1:20       ` Eryu Guan

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=20180322024809.GD4810@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=david@fromorbit.com \
    --cc=fstests@vger.kernel.org \
    --cc=guaneryu@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox