Skip to contentSkip to conversation

xfstests: Check the file system consistency on SCRATCH_DEV

PATCH Superseded Lukas Czerner 3 participants 6 messages Jun 24, 2014 – Jul 10, 2014

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 xfstests: Check the file system consistency on SCRATCH_DEV

There are about 198 tests which requires scratch_dev, but does not check the file system consistency afterwards. Xfstests infrastructure does not do it automatically, so fix it by running _check_scratch_fs() after the test if access time changed on the scratch device.

Also remove all the _check_scratch_fs() calls that are not actually needed and will be covered by the check script.

---
 check             | 5 +++++
 tests/btrfs/024   | 1 -
 tests/btrfs/043   | 2 --
 tests/btrfs/044   | 2 --
 tests/btrfs/045   | 2 --
 tests/btrfs/046   | 2 --
 tests/btrfs/047   | 2 --
 tests/btrfs/048   | 2 --
 tests/btrfs/050   | 2 --
 tests/btrfs/051   | 2 --
 tests/btrfs/053   | 2 --
 tests/btrfs/054   | 2 --
 tests/ext4/271    | 3 +--
 tests/ext4/301    | 3 +--
 tests/ext4/302    | 3 +--
 tests/ext4/303    | 3 +--
 tests/ext4/304    | 3 +--
 tests/generic/009 | 0
 tests/generic/017 | 6 ------
 tests/generic/019 | 1 -
 tests/generic/026 | 0
 tests/generic/027 | 1 -
 tests/generic/068 | 2 --
 tests/generic/076 | 1 -
 tests/generic/083 | 1 -
 tests/generic/097 | 7 -------
 tests/generic/099 | 7 -------
 tests/generic/100 | 1 -
 tests/generic/117 | 2 --
 tests/generic/124 | 3 ---
 tests/generic/204 | 2 --
 tests/generic/269 | 3 +--
 tests/generic/270 | 3 +--
 tests/generic/273 | 3 +--
 tests/generic/299 | 3 +--
 tests/generic/300 | 3 +--
 tests/generic/312 | 1 -
 tests/generic/315 | 0
 tests/generic/320 | 1 -
 tests/generic/321 | 2 --
 tests/generic/322 | 2 --
 tests/shared/006  | 1 -
 tests/shared/272  | 3 +--
 tests/xfs/010     | 1 -
 tests/xfs/011     | 1 -
 tests/xfs/013     | 1 -
 tests/xfs/014     | 1 -
 tests/xfs/019     | 3 ---
 tests/xfs/019.out | 1 -
 tests/xfs/034     | 2 --
 tests/xfs/042     | 1 -
 tests/xfs/042.out | 1 -
 tests/xfs/085     | 6 ------
 tests/xfs/085.out | 1 -
 tests/xfs/104     | 1 -
 tests/xfs/110     | 2 --
 tests/xfs/121     | 3 ---
 tests/xfs/181     | 3 ---
 tests/xfs/278     | 5 -----
 tests/xfs/297     | 1 -
 tests/xfs/306     | 1 -
 61 files changed, 16 insertions(+), 119 deletions(-)
 mode change 100644 => 100755 tests/generic/009
 mode change 100644 => 100755 tests/generic/026
 mode change 100644 => 100755 tests/generic/315
 mode change 100644 => 100755 tests/generic/321
 mode change 100644 => 100755 tests/generic/322
check +5 -0
index b1eaed2..40f99d7 100755
@@ -543,6 +543,7 @@ for section in $HOST_OPTIONS_SECTIONS; do
 		fi
 		rm -f core $seqres.notrun
 
+		scratch_atime=`stat -c %X $SCRATCH_DEV`
 		start=`_wallclock`
 		$timestamp && echo -n "	["`date "+%T"`"]"
 		[ ! -x $seq ] && chmod u+x $seq # ensure we can run it
@@ -626,6 +627,10 @@ for section in $HOST_OPTIONS_SECTIONS; do
 		try="$try $seqnum"
 		n_try=`expr $n_try + 1`
 		_check_test_fs
+		atime=`stat -c %X $SCRATCH_DEV`
+		if [ $atime -ne $scratch_atime ]; then
+			_check_scratch_fs
+		fi
 	    fi
 
 	    seq="after_$seqnum"
tests/btrfs/024 +0 -1
index cb8a6e4..03d105a 100755
@@ -77,7 +77,6 @@ _scratch_mkfs > /dev/null 2>&1
 _scratch_mount "-o compress-force=no"
 __workout
 _scratch_unmount
-_check_scratch_fs
 
 echo "*** done"
 status=0 ; exit
tests/btrfs/043 +0 -2
index b1fef96..4993349 100644
@@ -143,7 +143,5 @@ run_check $FSSUM_PROG -r $tmp/1.fssum $SCRATCH_MNT/mysnap1
 _run_btrfs_util_prog receive $SCRATCH_MNT -f $tmp/2.snap
 run_check $FSSUM_PROG -r $tmp/2.fssum $SCRATCH_MNT/mysnap2
 
-_check_scratch_fs
-
 status=0
 exit
tests/btrfs/044 +0 -2
index dae189e..5565b86 100644
@@ -123,7 +123,5 @@ run_check $FSSUM_PROG -r $tmp/1.fssum $SCRATCH_MNT/mysnap1
 _run_btrfs_util_prog receive $SCRATCH_MNT -f $tmp/2.snap
 run_check $FSSUM_PROG -r $tmp/2.fssum $SCRATCH_MNT/mysnap2
 
-_check_scratch_fs
-
 status=0
 exit
tests/btrfs/045 +0 -2
index 4567a3f..8570fa6 100755
@@ -370,7 +370,5 @@ run_check $FSSUM_PROG -r $tmp/1.fssum $SCRATCH_MNT/mysnap1
 _run_btrfs_util_prog receive $SCRATCH_MNT -f $tmp/2.snap
 run_check $FSSUM_PROG -r $tmp/2.fssum $SCRATCH_MNT/mysnap2
 
-_check_scratch_fs
-
 status=0
 exit
tests/btrfs/046 +0 -2
index 685e359..c0d10e1 100644
@@ -298,7 +298,5 @@ echo "File digests in the replica filesystem:"
 md5sum $SCRATCH_MNT/mysnap1/foo | _filter_scratch
 md5sum $SCRATCH_MNT/mysnap2/foo | _filter_scratch
 
-_check_scratch_fs
-
 status=0
 exit
tests/btrfs/047 +0 -2
index 2dc6499..8b20e79 100755
@@ -116,7 +116,5 @@ $XFS_IO_PROG -r -c "seek -r -a 0" $SCRATCH_MNT/mysnap2/foo
 # the file's size.
 $XFS_IO_PROG -r -c "fiemap -v" $SCRATCH_MNT/mysnap2/foo | _filter_fiemap
 
-_check_scratch_fs
-
 status=0
 exit
tests/btrfs/048 +0 -2
index e998f97..2a9bfc3 100755
@@ -214,7 +214,5 @@ $BTRFS_UTIL_PROG property get $SCRATCH_MNT/sv1 compression
 touch $SCRATCH_MNT/sv1/file2
 $BTRFS_UTIL_PROG property get $SCRATCH_MNT/sv1/file2 compression
 
-_check_scratch_fs
-
 status=0
 exit
tests/btrfs/050 +0 -2
index 6e4bd13..9079408 100755
@@ -103,7 +103,5 @@ _scratch_mount
 _run_btrfs_util_prog receive $SCRATCH_MNT -f $send_files_dir/1.snap
 run_check $FSSUM_PROG -r $send_files_dir/1.fssum $SCRATCH_MNT/mysnap1
 
-_check_scratch_fs
-
 status=0
 exit
tests/btrfs/051 +0 -2
index 53df664..deaa765 100755
@@ -79,7 +79,5 @@ _scratch_mount
 _run_btrfs_util_prog receive $SCRATCH_MNT -f $send_files_dir/1.snap
 run_check $FSSUM_PROG -r $send_files_dir/1.fssum $SCRATCH_MNT/mysnap1
 
-_check_scratch_fs
-
 status=0
 exit
tests/btrfs/053 +0 -2
index 3994110..7eef55f 100755
@@ -103,7 +103,5 @@ run_check $FSSUM_PROG -r $send_files_dir/1.fssum $SCRATCH_MNT/mysnap1
 _run_btrfs_util_prog receive $SCRATCH_MNT -f $send_files_dir/2.snap
 run_check $FSSUM_PROG -r $send_files_dir/2.fssum $SCRATCH_MNT/mysnap2
 
-_check_scratch_fs
-
 status=0
 exit
tests/btrfs/054 +0 -2
index 215861c..258eead 100755
@@ -103,7 +103,5 @@ _run_btrfs_util_prog receive $SCRATCH_MNT -f $send_files_dir/2.snap
 [ -e $SCRATCH_MNT/testdir ] && \
 	echo "Directory testdir was supposed to be deleted after incremental send!"
 
-_check_scratch_fs
-
 status=0
 exit
tests/ext4/271 +1 -2
index 274e904..e77ae57 100755
@@ -62,6 +62,5 @@ if ! _scratch_unmount; then
 	exit
 fi
 echo "Check filesystem"
-_check_scratch_fs
-status=$?
+status=0
 exit
tests/ext4/301 +1 -2
index 0ca3622..568327d 100755
@@ -121,5 +121,4 @@ if ! _scratch_unmount; then
 	status=1
 	exit
 fi
-_check_scratch_fs
-status=$?
+status=0
tests/ext4/302 +1 -2
index 497f4c6..1e90016 100755
@@ -137,6 +137,5 @@ if ! _scratch_unmount; then
 	status=1
 	exit
 fi
-_check_scratch_fs
-status=$?
+status=0
 exit
tests/ext4/303 +1 -2
index 93354e5..9573872 100755
@@ -147,6 +147,5 @@ if ! _scratch_unmount; then
 	status=1
 	exit
 fi
-_check_scratch_fs
-status=$?
+status=0
 exit
tests/ext4/304 +1 -2
index 74e601a..b9b4356 100755
@@ -124,6 +124,5 @@ if ! _scratch_unmount; then
 	status=1
 	exit
 fi
-_check_scratch_fs
-status=$?
+status=0
 exit
tests/generic/009 +0 -0
old mode 100644
new mode 100755
tests/generic/017 +0 -6
index 11705bf..c769dd8 100755
@@ -67,12 +67,6 @@ done
 # Check if 80 extents are present
 $XFS_IO_PROG -c "fiemap -v" $testfile | grep "^ *[0-9]*:" |wc -l
 
-_check_scratch_fs
-if [ $? -ne 0 ]; then
-	status=1
-	exit
-fi
-
 # success, all done
 status=0
 exit
tests/generic/019 +0 -1
index 7a019ad..b387507 100755
@@ -171,7 +171,6 @@ _workout()
 	# perform mount/umount, after that all errors should be fixed
 	run_check _scratch_mount
 	run_check _scratch_unmount
-	_check_scratch_fs
 }
 
 # real QA test starts here
tests/generic/026 +0 -0
old mode 100644
new mode 100755
tests/generic/027 +0 -1
index b9232ec..8dab117 100755
@@ -101,7 +101,6 @@ while [ $i -le $loop ]; do
 	let i=$i+1
 done
 _scratch_unmount
-_check_scratch_fs
 
 status=0
 exit
tests/generic/068 +0 -2
index a764019..7794326 100755
@@ -130,6 +130,4 @@ rm $tmp.running
 # wait for fsstresses to finish
 wait
 
-_check_scratch_fs
-
 exit 1
tests/generic/076 +0 -1
index a53840f..02af762 100755
@@ -77,7 +77,6 @@ FSSTRESS_ARGS=`_scale_fsstress_args -p 2 -n 2000 $FSSTRESS_AVOID`
 echo "run fsstress with args: $FSSTRESS_ARGS" >>$seqres.full
 $FSSTRESS_PROG $FSSTRESS_ARGS >>$seqres.full
 _lets_get_pidst
-_check_scratch_fs
 
 echo "*** done"
 status=0
tests/generic/083 +0 -1
index f9135f8..61316bf 100755
@@ -84,7 +84,6 @@ workout()
 	# -w ensures that the only ops are ones which cause write I/O
 	FSSTRESS_ARGS=`_scale_fsstress_args -d $SCRATCH_MNT -w -p $procs -n $nops $FSSTRESS_AVOID`
 	$FSSTRESS_PROG $FSSTRESS_ARGS >>$seqres.full
-	_check_scratch_fs
 }
 
 echo "*** test out-of-space handling for random write operations"
tests/generic/097 +0 -7
index c120422..f40d5d5 100755
@@ -244,13 +244,6 @@ ${ATTR_PROG} -R -l foo
 
 cd /
 
-# Check the filesystem
-_check_scratch_fs
-
-# optional stuff if your test has verbose output to help resolve problems
-#echo
-#echo "If failure, check $seqres.full (this) and $seqres.full.ok (reference)"
-
 # success, all done
 status=0
 exit
tests/generic/099 +0 -7
index 7351966..83097e9 100755
@@ -328,13 +328,6 @@ chacl $acl3 largeaclfile
 _acl_list largeaclfile | _filter_aces_notypes
 
 #-------------------------------------------------------
-
-if [ "$FSTYP" == "udf" ]; then
-    cd /
-    umount $TARGET_DIR
-    # Check the filesystem
-    _check_scratch_fs
-fi
 # success, all done
 status=0
 exit
tests/generic/100 +0 -1
index 05d766f..00ba23e 100755
@@ -80,7 +80,6 @@ ls -R -l ${TEST_DIR}${POPULATED_DIR} >>$seqres.full 2>&1
 diff -qr $POPULATED_DIR ${TEST_DIR}${POPULATED_DIR}
 
 cd /
-_check_scratch_fs
 
 status=0
 exit
tests/generic/117 +0 -2
index f81265b..935dcaf 100755
@@ -108,8 +108,6 @@ cd /
 umount $SCRATCH_MNT
 echo 
 echo Checking filesystem
-_check_scratch_fs
-_scratch_mount
 
 status=$?
 exit
tests/generic/124 +0 -3
index 93ec4a1..77f6e7d 100755
@@ -76,7 +76,4 @@ fi
 
 umount $SCRATCH_DEV
 
-_check_test_fs
-_check_scratch_fs
-
 exit 
tests/generic/204 +0 -2
index de029c6..d6bb094 100755
@@ -83,8 +83,6 @@ for i in `seq 1 $files`; do
     echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX > $SCRATCH_MNT/$i
 done
 
-_check_scratch_fs
-
 # success, all done
 echo "*** done"
 status=0
tests/generic/269 +1 -2
index 684cf42..cff5e54 100755
@@ -79,6 +79,5 @@ if ! _scratch_unmount; then
 	status=1
 	exit
 fi
-_check_scratch_fs
-status=$?
+status=0
 exit
tests/generic/270 +1 -2
index b5ed7af..cebd377 100755
@@ -104,6 +104,5 @@ if ! _scratch_unmount; then
 	status=1
 	exit
 fi
-_check_scratch_fs
-status=$?
+status=0
 exit
tests/generic/273 +1 -2
index 8e121a2..1ceb6c4 100755
@@ -138,6 +138,5 @@ _scratch_mount
 
 _do_workload
 
-_check_scratch_fs
-status=$?
+status=0
 exit
tests/generic/299 +1 -2
index bf02c94..e8685a4 100755
@@ -152,6 +152,5 @@ if ! _scratch_unmount; then
 	status=1
 	exit
 fi
-_check_scratch_fs
-status=$?
+status=0
 exit
tests/generic/300 +1 -2
index 01d4600..5234d05 100755
@@ -155,6 +155,5 @@ if ! _scratch_unmount; then
 	status=1
 	exit
 fi
-_check_scratch_fs
-status=$?
+status=0
 exit
tests/generic/312 +0 -1
index 7611bb9..b035978 100755
@@ -67,6 +67,5 @@ echo "Silence is golden"
 $XFS_IO_PROG -f -c "falloc 0 6g" $SCRATCH_MNT/testfile.$seq >>$seqres.full 2>&1
 
 _scratch_unmount
-_check_scratch_fs
 status=0
 exit
tests/generic/315 +0 -0
old mode 100644
new mode 100755
tests/generic/320 +0 -1
index e1ba970..3dd3bea 100755
@@ -116,6 +116,5 @@ _scratch_mount >>$seqres.full 2>&1
 
 do_workload
 
-_check_scratch_fs
 status=0
 exit
tests/generic/321 +0 -2
old mode 100644
new mode 100755
index 345416c..8410d40
@@ -121,8 +121,6 @@ _replay_rename_test()
 	_ls_l $SCRATCH_MNT | tail -n +2 | awk '{ print $1, $9 }'
 	_ls_l $SCRATCH_MNT/bar | tail -n +2 | awk '{ print $1, $9 }'
 	_unmount_flakey
-	_check_scratch_fs $FLAKEY_DEV
-	[ $? -ne 0 ] && _fatal "fsck failed"
 }
 
 _scratch_mkfs >> $seqres.full 2>&1
tests/generic/322 +0 -2
old mode 100644
new mode 100755
index c43fcb1..fe1a4d5
@@ -94,8 +94,6 @@ _write_after_fsync_rename_test()
 	_mount_flakey
 	md5sum $SCRATCH_MNT/bar | _filter_scratch
 	_unmount_flakey
-	_check_scratch_fs $FLAKEY_DEV
-	[ $? -ne 0 ] && _fatal "fsck failed"
 }
 
 _scratch_mkfs >> $seqres.full 2>&1
tests/shared/006 +0 -1
index 445c35d..55c5965 100755
@@ -91,7 +91,6 @@ _check_scratch_fs
 rm -rf $SCRATCH_MNT/testdir
 echo "Inode status after deleting all test files" >>$seqres.full
 $DF_PROG -i $SCRATCH_MNT >>$seqres.full
-_check_scratch_fs
 
 status=0
 exit
tests/shared/272 +1 -2
index 0f812f3..4417535 100755
@@ -103,6 +103,5 @@ if ! _scratch_unmount; then
 	exit
 fi
 echo "Check filesystem"
-_check_scratch_fs
-status=$?
+status=0
 exit
tests/xfs/010 +0 -1
index 2b5ad00..fd2e27c 100755
@@ -127,7 +127,6 @@ _check_scratch_fs
 _corrupt_finobt_root $SCRATCH_DEV
 
 _scratch_xfs_repair 2>&1 | _filter_repair
-_check_scratch_fs
 
 status=0
 exit
tests/xfs/011 +0 -1
index 5763af9..658a822 100755
@@ -110,7 +110,6 @@ killall $FSSTRESS_PROG
 wait
 
 umount $SCRATCH_MNT
-_check_scratch_fs
 
 status=0
 exit
tests/xfs/013 +0 -1
index d47bf53..dea3d08 100755
@@ -150,7 +150,6 @@ rm -rf $SCRATCH_MNT/fsstress
 rm -rf $SCRATCH_MNT/dir*
 
 umount $SCRATCH_MNT
-_check_scratch_fs
 
 status=0
 exit
tests/xfs/014 +0 -1
index 1e092a9..8866bfe 100755
@@ -194,7 +194,6 @@ umount $LOOP_MNT
 echo $orig_sp_time > /proc/sys/fs/xfs/speculative_prealloc_lifetime
 
 umount $SCRATCH_MNT
-_check_scratch_fs
 
 status=0
 exit
tests/xfs/019 +0 -3
index d35d15b..09670b9 100755
@@ -136,9 +136,6 @@ _verify_fs()
 	_full "umount"
 	umount $SCRATCH_DEV >>$seqfull 2>&1 \
 		|| _fail "umount failed"
-
-	echo "*** check FS"
-	_check_scratch_fs
 }
 
 #_verify_fs 1
tests/xfs/019.out +0 -1
index 0c1bf8f..19614d9 100644
@@ -79,6 +79,5 @@ Device: <DEVICE> Inode: <INODE> Links: 1
  Mode: (0123/l--x-w--wx) Uid: (0) Gid: (0)
 Device: <DEVICE> Inode: <INODE> Links: 1 
 *** unmount FS
-*** check FS
 *** done
 *** unmount
tests/xfs/034 +0 -2
index 6f73fdd..6beeb56 100755
@@ -83,8 +83,6 @@ then
 fi
 
 # pv 801241 causes corruption here (inode left in agi_unlinked list)
-_check_scratch_fs
-
 echo "*** done"
 # happy exit
 status=0
tests/xfs/042 +0 -1
index db0fa28..77dd704 100755
@@ -162,7 +162,6 @@ if ! _do "diff $tmp.sum1 $tmp.sum2"; then
     status=1; exit
 fi
 echo "done"
-_do "Checking filesystem" "_check_scratch_fs"
 
 # success, all done
 echo "xfs_fsr tests passed."
tests/xfs/042.out +0 -1
index f5b37b3..41baf09 100644
@@ -9,5 +9,4 @@ Remove other files... done
 Run xfs_fsr on filesystem... done
 Check fill file... done
 Check large file... done
-Checking filesystem... done
 xfs_fsr tests passed.
tests/xfs/085 +0 -6
index af71b77..54c2d01 100755
@@ -88,12 +88,6 @@ umount $SCRATCH_MNT
 echo "logprint after mount and replay..."
 _print_logstate
 
-if _check_scratch_fs; then
-    echo "filesystem is checked ok"
-else
-    echo "filesystem is NOT ok"
-fi
-
 # success, all done
 status=0
 exit
tests/xfs/085.out +0 -1
index 48e3e73..d2d99a1 100644
@@ -111,4 +111,3 @@ ls SCRATCH_MNT
 unmount
 logprint after mount and replay...
 clean log
-filesystem is checked ok
tests/xfs/104 +0 -1
index e899aca..69fcc69 100755
@@ -113,7 +113,6 @@ done
 wait	# stop for any remaining stress processes
 
 umount $SCRATCH_DEV
-_check_scratch_fs
 
 status=0
 exit
tests/xfs/110 +0 -2
index 48bea45..7428faf 100755
@@ -81,7 +81,5 @@ do
 done
 wait
 
-_check_scratch_fs
-
 status=0
 exit
tests/xfs/121 +0 -3
index 1e06e45..1457ed1 100755
@@ -106,9 +106,6 @@ fi
 _scratch_mount >> $seqres.full 2>&1 \
     || _fail "mount failed"
 
-# should now be peaches
-_check_scratch_fs
-
 # success, all done
 status=0
 exit
tests/xfs/181 +0 -3
index 38d556c..4e7ac3a 100755
@@ -120,9 +120,6 @@ fi
 _scratch_mount >> $seqres.full 2>&1 \
     || _fail "mount failed"
 
-# should now be peaches
-_check_scratch_fs
-
 # success, all done
 status=0
 exit
tests/xfs/278 +0 -5
index dacd1fc..2b1db8a 100755
@@ -78,9 +78,4 @@ echo "" >>$seqres.full
 xfs_repair  $SCRATCH_DEV >> $seqres.full 2>&1
 echo "===== END of xfs_repair =====" >> $seqres.full
 
-#if _check_scratch_fs; then
-#	status=0
-#else
-#	status=1
-#fi
 exit
tests/xfs/297 +0 -1
index 3fe32f1..1cdbbb9 100755
@@ -82,6 +82,5 @@ echo "Test done" | tee -a $seqres.full
 killall -q $FSSTRESS_PROG
 wait
 
-_check_scratch_fs
 status=0
 exit
tests/xfs/306 +0 -1
index 0794de3..3053fd9 100644
@@ -97,7 +97,6 @@ for d in $load_dir/*; do
 done
 wait
 umount $SCRATCH_MNT
-_check_scratch_fs
 
 echo "No output is good. Failures are loud."
 
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 2/2 xfstests: Check fs consistency on TEST_DEV only when needed

Currently we're checking file system consistency on TEST_DEV after every successful test run even though the TEST_DEV might not even be used in that test.

Fix it by checking for number of write io on TEST_DEV device before the test and compare it with the value after the test.

---
 check     |  6 +++++-
 common/rc | 11 +++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)
check +5 -1
index 40f99d7..66d0f72 100755
@@ -544,6 +544,7 @@ for section in $HOST_OPTIONS_SECTIONS; do
 		rm -f core $seqres.notrun
 
 		scratch_atime=`stat -c %X $SCRATCH_DEV`
+		test_write_io=`_get_write_io_count $TEST_DEV`
 		start=`_wallclock`
 		$timestamp && echo -n "	["`date "+%T"`"]"
 		[ ! -x $seq ] && chmod u+x $seq # ensure we can run it
@@ -626,7 +627,10 @@ for section in $HOST_OPTIONS_SECTIONS; do
 	    then
 		try="$try $seqnum"
 		n_try=`expr $n_try + 1`
-		_check_test_fs
+		write_io=`_get_write_io_count $TEST_DEV`
+		if [ -z $test_write_io ] || [ $write_io -ne $test_write_io ]; then
+			_check_test_fs
+		fi
 		atime=`stat -c %X $SCRATCH_DEV`
 		if [ $atime -ne $scratch_atime ]; then
 			_check_scratch_fs
common/rc +11 -0
index 95030ae..83e8734 100644
@@ -2165,6 +2165,17 @@ _scale_fsstress_args()
     echo $args
 }
 
+_get_write_io_count()
+{
+	if [ -z $1 ]; then
+		echo "Missing device argument for _get_write_io_count"
+		exit 1
+	fi
+	major_minor=$(printf "%d:%d" `stat -c "0x%t" $1` `stat -c "0x%T" $1`)
+	sync
+	cat /sys/dev/block/${major_minor}/stat 2> /dev/null | awk '{print $5}'
+}
+
 #
 # Return the logical block size if running on a block device,
 # else substitute the page size.
Signature · 1 line
1.8.3.1
#2 lore raw

Re: [PATCH 2/2] xfstests: Check fs consistency on TEST_DEV only when needed

Quoted 3 lines · Lukas Czerner

Currently we're checking file system consistency on TEST_DEV after every successful test run even though the TEST_DEV might not even be used in that test.

It gets mounted/unmounted for each test, so even if it is not used, it might still get modified...

Quoted 2 lines

Fix it by checking for number of write io on TEST_DEV device before the test and compare it with the value after the test.

Doesn't work for ram disks:

# ./setup 
TEST: DIR=/mnt/test DEV=/dev/ram0 rt=[] log=[]
TAPE: dev=[] rmt=[] rmtirix=[@]
SCRATCH: MNT=/mnt/scr DEV=/dev/ram1 rt=[] log=[]
VARIABLES: external=no largeblk=no fstyp=xfs
           large_scratch_dev=no attrsecure=no
# ls -l /dev/ram0
brw-rw---- 1 root disk 1, 0 Jul  9 15:51 /dev/ram0
# cat /sys/dev/block/1\:0/stat
       0        0        0        0        0        0        0        0        0        0        0
#

Nor does it work on loop devices.

Quoted 19 lines
---
 check     |  6 +++++-
 common/rc | 11 +++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)
check +1 -0
index 40f99d7..66d0f72 100755
@@ -544,6 +544,7 @@ for section in $HOST_OPTIONS_SECTIONS; do
 		rm -f core $seqres.notrun
 
 		scratch_atime=`stat -c %X $SCRATCH_DEV`
+		test_write_io=`_get_write_io_count $TEST_DEV`
 		start=`_wallclock`
 		$timestamp && echo -n "	["`date "+%T"`"]"
 		[ ! -x $seq ] && chmod u+x $seq # ensure we can run it

check for section in $HOST_OPTIONS_SECTIONS; do · line 633

Quoted 8 lines
check +4 -1
@@ -626,7 +627,10 @@ for section in $HOST_OPTIONS_SECTIONS; do
 	    then
 		try="$try $seqnum"
 		n_try=`expr $n_try + 1`
-		_check_test_fs
+		write_io=`_get_write_io_count $TEST_DEV`
+		if [ -z $test_write_io ] || [ $write_io -ne $test_write_io ]; then
+			_check_test_fs
+		fi

Which you work around without mentioning the reason for the zero value check. ;)

Personally, I want the test devices on my systems checked regardless of whether the test tries to modify them or not. I, quite frankly, don't trust the block device stats because they often get broken or are inaccurate. Indeed, there were recent virtio block device changes in 3.14-rc1 (or was it 3.15?) that broke the device stats and that took several weeks to get fixed properly.

Hence I don't think using the block device stats for something as critical as determining whether we should check a filesystem or not.

Reducing runtime of the test harness is a good idea, but we should not do that if the cost is that it reduces the reliability of error detection.

Cheers,

Dave.

Signature · 2 lines
Dave Chinner
[email protected]
#3 lore raw

Re: [PATCH 2/2] xfstests: Check fs consistency on TEST_DEV only when needed

Quoted 3 lines · Dave Chinner

Reducing runtime of the test harness is a good idea, but we should not do that if the cost is that it reduces the reliability of error detection.

Still, this could have a really big impact, especially on filesystems with slow fsck.

It'd be great to find a way to make this reliable.

It's kind of a historical accident that "test" is always mounted, but "scratch" must be _required. What if we added _require_test if we're going to write to test, and doing so triggers the check?

I'm sure there are other ways around it. Spending tons of time in fsck for a filesystem we didn't touch isn't time well spent, IMHO.

-Eric

#4 lore raw

Re: [PATCH 2/2] xfstests: Check fs consistency on TEST_DEV only when needed

In reply to Dave Chinner
Quoted 56 lines · Dave Chinner

Date: Thu, 10 Jul 2014 11:07:11 +1000
From: Dave Chinner <[email protected]>
To: Lukas Czerner <[email protected]>
Cc: [email protected], [email protected]
Subject: Re: [PATCH 2/2] xfstests: Check fs consistency on TEST_DEV only when
needed

Quoted 3 lines · Lukas Czerner

Currently we're checking file system consistency on TEST_DEV after every successful test run even though the TEST_DEV might not even be used in that test.

It gets mounted/unmounted for each test, so even if it is not used, it might still get modified...

Quoted 2 lines

Fix it by checking for number of write io on TEST_DEV device before the test and compare it with the value after the test.

Doesn't work for ram disks:

# ./setup 
TEST: DIR=/mnt/test DEV=/dev/ram0 rt=[] log=[]
TAPE: dev=[] rmt=[] rmtirix=[@]
SCRATCH: MNT=/mnt/scr DEV=/dev/ram1 rt=[] log=[]
VARIABLES: external=no largeblk=no fstyp=xfs
           large_scratch_dev=no attrsecure=no
# ls -l /dev/ram0
brw-rw---- 1 root disk 1, 0 Jul  9 15:51 /dev/ram0
# cat /sys/dev/block/1\:0/stat
       0        0        0        0        0        0        0        0        0        0        0
#

Nor does it work on loop devices.

Quoted 22 lines
---
 check     |  6 +++++-
 common/rc | 11 +++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)
check +1 -0
index 40f99d7..66d0f72 100755
@@ -544,6 +544,7 @@ for section in $HOST_OPTIONS_SECTIONS; do
 		rm -f core $seqres.notrun
 
 		scratch_atime=`stat -c %X $SCRATCH_DEV`
+		test_write_io=`_get_write_io_count $TEST_DEV`
 		start=`_wallclock`
 		$timestamp && echo -n "	["`date "+%T"`"]"
 		[ ! -x $seq ] && chmod u+x $seq # ensure we can run it
@@ -626,7 +627,10 @@ for section in $HOST_OPTIONS_SECTIONS; do
 	    then
 		try="$try $seqnum"
 		n_try=`expr $n_try + 1`
Quoted 8 lines

check for section in $HOST_OPTIONS_SECTIONS; do · line 633

Quoted 5 lines
check +4 -1
-		_check_test_fs
+		write_io=`_get_write_io_count $TEST_DEV`
+		if [ -z $test_write_io ] || [ $write_io -ne $test_write_io ]; then
+			_check_test_fs
+		fi

Which you work around without mentioning the reason for the zero value check. ;)

That's just a safety trigger :) Didn't think it was worth mentioning.

Quoted 8 lines

Personally, I want the test devices on my systems checked regardless of whether the test tries to modify them or not. I, quite frankly, don't trust the block device stats because they often get broken or are inaccurate. Indeed, there were recent virtio block device changes in 3.14-rc1 (or was it 3.15?) that broke the device stats and that took several weeks to get fixed properly.

Quoted 6 lines

Hence I don't think using the block device stats for something as critical as determining whether we should check a filesystem or not.

Reducing runtime of the test harness is a good idea, but we should not do that if the cost is that it reduces the reliability of error detection.

With the patch 1/2 we're going to check scratch dev as well, so if accepted, the xfstests run time is going to be possibly much longer especially so on the file systems where fsck time is quite big. So I think that trying to reduce unnecessary fsck on test_dev is IMO important.

I like the idea Eric proposed with the _require_test check for the test that actually require test device and then actually check the device only after such test. Will that be acceptable ? If so I'll rework the patches.

Thanks!
-Lukas

Quoted 5 lines

Cheers,

Dave.

#5 lore raw

Re: [PATCH 2/2] xfstests: Check fs consistency on TEST_DEV only when needed

Quoted 5 lines · Lukáš Czerner

On Thu, 10 Jul 2014, Dave Chinner wrote:
I like the idea Eric proposed with the _require_test check for the test that actually require test device and then actually check the device only after such test. Will that be acceptable ? If so I'll rework the patches.

Works for me. Don't forget to add it to the "new" script as well so the default is to check the test device. That will trigger us to check if it is necessary during test development review, rather than forgetting we need to add it. ;)

Cheers,

Dave.

Signature · 2 lines
Dave Chinner
[email protected]