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>
local mountpoint="$1"
local device="$2"
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"
echo "Usage: _supports_xfs_scrub mountpoint device"
+ return 1
+ fi
+
+ if [ ! -b "$device" ] || [ ! -e "$mountpoint" ]; then
+ return 1
fi
test "$FSTYP" = "xfs" || return 1
fi
test "$FSTYP" = "xfs" || return 1