diff mbox

[20/20] xfs: scrub fs (if still mounted) at the end of the test

Message ID 146612808781.25024.9354886387434772563.stgit@birch.djwong.org (mailing list archive)
State Not Applicable
Headers show

Commit Message

Darrick J. Wong June 17, 2016, 1:48 a.m. UTC
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>
---
 common/config |    1 +
 common/rc     |    7 +++++++
 2 files changed, 8 insertions(+)



--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/common/config b/common/config
index cacd815..41edb0c 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 847191e..ea5baea 100644
--- a/common/rc
+++ b/common/rc
@@ -2188,6 +2188,13 @@  _check_xfs_filesystem()
 
     if [ "$type" = "xfs" ]
     then
+	if [ -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