xfs/189: skip 'barrier' mount option test on newer kernels
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 5 Oct 2018 00:19:26 +0000 (17:19 -0700)
committerEryu Guan <guaneryu@gmail.com>
Sun, 14 Oct 2018 15:09:32 +0000 (23:09 +0800)
Starting in Linux 4.19 the 'barrier' and 'nobarrier' mount options were
removed.  If mount complains about a bad option when we remount with
'barrier', just skip the test.

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>
tests/xfs/189

index c1c52a225bb9061e670302967b105149d6bcb163..2a2682efe2a3f5b39c5c2d7831a6f50802f5d761 100755 (executable)
@@ -165,7 +165,19 @@ _test_remount_barrier()
        echo
 
        # mention barrier explicitly even if it's currently the default just to be sure
-       _try_scratch_mount -o barrier
+       _try_scratch_mount -o barrier > $tmp.barriermount 2>&1
+
+       # If the kernel doesn't recognize 'barrier' as a mount option then
+       # just fake the output.  The barrier option was removed in 4.19.
+       if grep -q "bad option" $tmp.barriermount; then
+               cat << ENDL
+SCRATCH_DEV on SCRATCH_MNT type xfs (rw)
+SCRATCH_DEV on SCRATCH_MNT type xfs (rw,nobarrier)
+SCRATCH_DEV on SCRATCH_MNT type xfs (rw)
+ENDL
+               return
+       fi
+
        [ $? -eq 0 ] || echo "mount failed unexpectedly!"
        _check_mount rw