From 9bab148bb3c7db94bff98f2f479a990866130d38 Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Fri, 30 Dec 2022 14:19:41 -0800 Subject: [PATCH] common/fuzzy: exercise the filesystem a little harder after repairing Use fsstress to exercise the filesystem a little more strenuously after we've run the fuzzing repair strategy, so that we have a better chance of tripping over corruption problems. Signed-off-by: Darrick J. Wong Reviewed-by: Zorro Lang Signed-off-by: Zorro Lang --- common/fuzzy | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/common/fuzzy b/common/fuzzy index af46415c..d2039d20 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -6,30 +6,18 @@ # Modify various files after a fuzzing operation _scratch_fuzz_modify() { - nr="$1" - - test -z "${nr}" && nr=50000 - echo "+++ touch ${nr} files" - blk_sz=$(stat -f -c '%s' ${SCRATCH_MNT}) - $XFS_IO_PROG -f -c "pwrite -S 0x63 0 ${blk_sz}" "/tmp/afile" > /dev/null - date="$(date)" - find "${SCRATCH_MNT}/" -type f 2> /dev/null | head -n "${nr}" | while read f; do - # try to remove append, immutable (and even dax) flag if exists - $XFS_IO_PROG -rc 'chattr -x -i -a' "$f" > /dev/null 2>&1 - setfattr -n "user.date" -v "${date}" "$f" - cat "/tmp/afile" >> "$f" - mv "$f" "$f.longer" - done - sync - rm -rf "/tmp/afile" - - echo "+++ create files" - mkdir -p "${SCRATCH_MNT}/test.moo" - $XFS_IO_PROG -f -c 'pwrite -S 0x80 0 65536' "${SCRATCH_MNT}/test.moo/urk" > /dev/null - sync - - echo "+++ remove files" - rm -rf "${SCRATCH_MNT}/test.moo" + echo "+++ stressing filesystem" + mkdir -p $SCRATCH_MNT/data + _xfs_force_bdev data $SCRATCH_MNT/data + $FSSTRESS_PROG -n $((TIME_FACTOR * 10000)) -p $((LOAD_FACTOR * 4)) -d $SCRATCH_MNT/data + + if _xfs_has_feature "$SCRATCH_MNT" realtime; then + mkdir -p $SCRATCH_MNT/rt + _xfs_force_bdev realtime $SCRATCH_MNT/rt + $FSSTRESS_PROG -n $((TIME_FACTOR * 10000)) -p $((LOAD_FACTOR * 4)) -d $SCRATCH_MNT/rt + else + echo "+++ xfs realtime not configured" + fi } # Try to access files after fuzzing @@ -429,7 +417,7 @@ _scratch_xfs_fuzz_field_modifyfs() { # Try modifying the filesystem again __fuzz_notify "++ Try to write filesystem again" - _scratch_fuzz_modify 100 2>&1 + _scratch_fuzz_modify 2>&1 # If we didn't repair anything, there's no point in checking further, # the fs is still corrupt. -- 2.39.5