aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2018-03-21 19:48:09 -0700
committerEryu Guan <guaneryu@gmail.com>2018-03-23 12:44:02 +0800
commit8aa212310d62295488d23bf7958d2329c287a8c9 (patch)
tree47b3ed8704b3384ae56c98df8d07670410c22498
parent064c618989630c7108f7c1f30b809232d9db67c7 (diff)
downloadxfstests-dev-8aa212310d62295488d23bf7958d2329c287a8c9.tar.gz
common/xfs: fix various problems with _supports_xfs_scrub
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> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
-rw-r--r--common/xfs8
1 files changed, 6 insertions, 2 deletions
diff --git a/common/xfs b/common/xfs
index 56531f914c..3169f8710d 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