From: Darrick J. Wong <djwong@xxxxxxxxxx> If the online fsck stress tests run for long enough, they'll fill up the scratch filesystem completely. While it is interesting to test repair functionality on a *nearly* full filesystem undergoing a heavy workload, a totally full filesystem is really only exercising the ENOSPC handlers in the kernel. That's not what we came here to test, so change the fsstress loop to detect a nearly full filesystem and erase everything before starting fsstress again. Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> --- common/fuzzy | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/common/fuzzy b/common/fuzzy index f1bc2dc756..01cf7f00d8 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -380,6 +380,20 @@ __stress_one_scrub_loop() { done } +# Clean the scratch filesystem between rounds of fsstress if there is 2% +# available space or less because that isn't an interesting stress test. +# +# Returns 0 if we cleared anything, and 1 if we did nothing. +__stress_scrub_clean_scratch() { + local used_pct="$(_used $SCRATCH_DEV)" + + test "$used_pct" -lt 98 && return 1 + + echo "Clearing scratch fs at $(date)" >> $seqres.full + rm -r -f $SCRATCH_MNT/p* + return 0 +} + # Run fsstress while we're testing online fsck. __stress_scrub_fsstress_loop() { local end="$1" @@ -389,6 +403,8 @@ __stress_scrub_fsstress_loop() { echo "Running $FSSTRESS_PROG $args" >> $seqres.full while __stress_scrub_running "$end" "$runningfile"; do + # Need to recheck running conditions if we cleared anything + __stress_scrub_clean_scratch && continue $FSSTRESS_PROG $args >> $seqres.full echo "fsstress exits with $? at $(date)" >> $seqres.full done