diff options
author | Darrick J. Wong <djwong@kernel.org> | 2023-06-06 15:29:39 -0700 |
---|---|---|
committer | Zorro Lang <zlang@kernel.org> | 2023-06-10 15:35:59 +0800 |
commit | 8b88f4ca28ff93e3b87637a3f23d313d4118be6b (patch) | |
tree | 1ce0afba23c233870be7465e0a64c094d4b7c79c | |
parent | 0adf9e7c0d591445d0a3933f3b15136b2a87fb46 (diff) | |
download | xfstests-dev-8b88f4ca28ff93e3b87637a3f23d313d4118be6b.tar.gz |
common/xfs: compress online repair rebuild output by default
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>
-rw-r--r-- | common/xfs | 19 |
1 files 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 |