[PATCH 3/3] common/xfs: compress online repair rebuild output by default

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Darrick J. Wong <djwong@xxxxxxxxxx>

Force-repairing the filesystem after a test can fill up /tmp with quite
a lot of logging message.  We don't have a better place to stash that
output in case the scrub fails and we need to analyze it later, so
compress it with gzip and only decompress it later.

Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx>
---
 common/xfs |   19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)


diff --git a/common/xfs b/common/xfs
index d85acd9572..c7671f8f9d 100644
--- a/common/xfs
+++ b/common/xfs
@@ -910,25 +910,28 @@ _check_xfs_filesystem()
 		# repairs considerably when the directory tree is very large.
 		find $mntpt &>/dev/null &
 
-		XFS_SCRUB_FORCE_REPAIR=1 "$XFS_SCRUB_PROG" -v -d $mntpt > $tmp.scrub 2>&1
-		if [ $? -ne 0 ]; then
-			if grep -q 'No space left on device' $tmp.scrub; then
+		XFS_SCRUB_FORCE_REPAIR=1 "$XFS_SCRUB_PROG" -v -d $mntpt 2>&1 | gzip > $tmp.scrub.gz
+		ret=$?
+		if [ $ret -ne 0 ]; then
+			if zgrep -q 'No space left on device' $tmp.scrub.gz; then
 				# It's not an error if the fs does not have
 				# enough space to complete a repair.  We will
 				# check everything, though.
-				echo "*** XFS_SCRUB_FORCE_REPAIR=1 xfs_scrub -v -d ran out of space ***" >> $seqres.full
-				cat $tmp.scrub >> $seqres.full
+				echo "*** XFS_SCRUB_FORCE_REPAIR=1 xfs_scrub -v -d ran out of space ret=$ret ***" >> $seqres.full
+				echo "See $seqres.scrubout.gz for details." >> $seqres.full
+				mv $tmp.scrub.gz $seqres.scrubout.gz
 				echo "*** end xfs_scrub output" >> $seqres.full
 			else
 				_log_err "_check_xfs_filesystem: filesystem on $device failed scrub orebuild"
-				echo "*** XFS_SCRUB_FORCE_REPAIR=1 xfs_scrub -v -d output ***" >> $seqres.full
-				cat $tmp.scrub >> $seqres.full
+				echo "*** XFS_SCRUB_FORCE_REPAIR=1 xfs_scrub -v -d output ret=$ret ***" >> $seqres.full
+				echo "See $seqres.scrubout.gz for details." >> $seqres.full
+				mv $tmp.scrub.gz $seqres.scrubout.gz
 				echo "*** end xfs_scrub output" >> $seqres.full
 				ok=0
 				orebuild_ok=0
 			fi
 		fi
-		rm -f $tmp.scrub
+		rm -f $tmp.scrub.gz
 
 		# Clear force_repair because xfs_scrub could have set it
 		$XFS_IO_PROG -x -c 'inject noerror' "$mntpt" >> $seqres.full




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux