From: Darrick J. Wong Date: Thu, 21 Jul 2016 23:47:51 +0000 (-0700) Subject: xfs: scrub fs at the end of the test X-Git-Tag: v2022.05.01~2395 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=7f6f53aa50ae2c5ca374548ef2ed98d8405c8e28;p=users%2Fhch%2Fxfstests-dev.git xfs: scrub fs at the end of the test Teach _check_xfs_filesystem to scrub mounted filesystems before unmounting and fscking them. This is mostly to test the online scrub tool... Signed-off-by: Darrick J. Wong Reviewed-by: Eryu Guan Signed-off-by: Eryu Guan --- diff --git a/README b/README index 2be2053d5..3cac4b352 100644 --- a/README +++ b/README @@ -94,6 +94,9 @@ Preparing system for tests (IRIX and Linux): run xfs_repair -n to check the filesystem; xfs_repair to rebuild metadata indexes; and xfs_repair -n (a third time) to check the results of the rebuilding. + - set TEST_XFS_SCRUB=1 to have _check_xfs_filesystem run + xfs_scrub -vd to scrub the filesystem metadata online before + unmounting to run the offline check. - or add a case to the switch in common/config assigning these variables based on the hostname of your test diff --git a/common/config b/common/config index 08d5d8028..168f46cdd 100644 --- a/common/config +++ b/common/config @@ -163,6 +163,7 @@ export XFS_REPAIR_PROG="`set_prog_path xfs_repair`" export XFS_DB_PROG="`set_prog_path xfs_db`" export XFS_GROWFS_PROG=`set_prog_path xfs_growfs` export XFS_IO_PROG="`set_prog_path xfs_io`" +export XFS_SCRUB_PROG="`set_prog_path xfs_scrub`" export XFS_PARALLEL_REPAIR_PROG="`set_prog_path xfs_prepair`" export XFS_PARALLEL_REPAIR64_PROG="`set_prog_path xfs_prepair64`" export __XFSDUMP_PROG="`set_prog_path xfsdump`" diff --git a/common/rc b/common/rc index b19b698ca..3fb060090 100644 --- a/common/rc +++ b/common/rc @@ -2400,6 +2400,13 @@ _check_xfs_filesystem() if [ "$type" = "xfs" ] then + if [ -n "$TEST_XFS_SCRUB" ] && [ -x "$XFS_SCRUB_PROG" ]; then + "$XFS_SCRUB_PROG" $scrubflag -vd $device >>$seqres.full + if [ $? -ne 0 ]; then + echo "filesystem on $device failed scrub (see $seqres.full)" + ok=0 + fi + fi # mounted ... mountpoint=`_umount_or_remount_ro $device` fi