]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
xfs: scrub fs at the end of the test
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 21 Jul 2016 23:47:51 +0000 (16:47 -0700)
committerEryu Guan <eguan@redhat.com>
Fri, 12 Aug 2016 03:17:19 +0000 (11:17 +0800)
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 <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
README
common/config
common/rc

diff --git a/README b/README
index 2be2053d57e563d680b8c36e7029649f9d196bce..3cac4b35268513cc8051aa7743b3a81a3ddd81a4 100644 (file)
--- 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
index 08d5d80286aea011411f65d7afe60a8793faf710..168f46cddd20963f42e0e1a9a6d89be1520a19df 100644 (file)
@@ -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`"
index b19b698ca1f42024c82700355033454b41e87527..3fb0600909f06e5266bdc698e7a9c5cff2a795c0 100644 (file)
--- 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