]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
common/xfs: compress online repair rebuild output by default
authorDarrick J. Wong <djwong@kernel.org>
Tue, 6 Jun 2023 22:29:39 +0000 (15:29 -0700)
committerZorro Lang <zlang@kernel.org>
Sat, 10 Jun 2023 07:35:59 +0000 (15:35 +0800)
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@kernel.org>
Reviewed-by: Andrey Albershteyn <aalbersh@redhat.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/xfs

index d85acd957249c7d21bc6c6e196db6f77c1e88220..c7671f8f9d17f5aaa2dbc6a80271ac75e314d3ba 100644 (file)
@@ -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