generic/388: randomly recover via read-only mounts
PATCH 1/1 generic/388: randomly recover via read-only mounts
XFS has an issue where superblock counters may not be properly synced when recovery occurs via a read-only mount. This causes the filesystem to become inconsistent after unmount. To cover this test case, update generic/388 to switch between read-only and read-write mounts to perform log recovery.
---
I didn't think it was worth duplicating generic/388 to a whole new test just to invoke log recovery from a read-only mount. generic/388 is a rather general log recovery test and this preserves historical behavior of the test.
A prospective fix for the issue this reproduces on XFS is posted here:
https://lore.kernel.org/linux-xfs/[email protected]/
Brian
tests/generic/388 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
tests/generic/388 +8 -2
@@ -66,8 +66,14 @@ for i in $(seq 1 $((50 * TIME_FACTOR)) ); do ps -e | grep fsstress > /dev/null 2>&1 done - # quit if mount fails so we don't shutdown the host fs - _scratch_cycle_mount || _fail "cycle mount failed" + # Toggle between rw and ro mounts for recovery. Quit if any mount + # attempt fails so we don't shutdown the host fs. + if [ $((RANDOM % 2)) -eq 0 ]; then + _scratch_cycle_mount || _fail "cycle mount failed" + else + _scratch_cycle_mount "ro" || _fail "cycle ro mount failed" + _scratch_cycle_mount || _fail "cycle mount failed" + fi done # success, all done
Signature · 1 line
2.26.2
Quoted 30 lines · Brian Foster
XFS has an issue where superblock counters may not be properly synced when recovery occurs via a read-only mount. This causes the filesystem to become inconsistent after unmount. To cover this test case, update generic/388 to switch between read-only and read-write mounts to perform log recovery.
Signed-off-by Brian Foster <[email protected]>---
I didn't think it was worth duplicating generic/388 to a whole new test just to invoke log recovery from a read-only mount. generic/388 is a rather general log recovery test and this preserves historical behavior of the test.
A prospective fix for the issue this reproduces on XFS is posted here:
https://lore.kernel.org/linux-xfs/[email protected]/
Brian
tests/generic/388 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)tests/generic/388 +0
-0@@ -66,8 +66,14 @@ for i in $(seq 1 $((50 * TIME_FACTOR)) ); do ps -e | grep fsstress > /dev/null 2>&1 done
tests/generic/388 for i in $(seq 1 $((50 * TIME_FACTOR)) ); do · line 75
Quoted 10 lines
tests/generic/388 +7
-2- # quit if mount fails so we don't shutdown the host fs - _scratch_cycle_mount || _fail "cycle mount failed" + # Toggle between rw and ro mounts for recovery. Quit if any mount + # attempt fails so we don't shutdown the host fs. + if [ $((RANDOM % 2)) -eq 0 ]; then + _scratch_cycle_mount || _fail "cycle mount failed" + else + _scratch_cycle_mount "ro" || _fail "cycle ro mount failed" + _scratch_cycle_mount || _fail "cycle mount failed"
I would change that third failure message to something distinct, like:
_fail "cycle remount failed"
To give us extra clues as to which branch encountered failure. This looks like a fun way to find new bugs. :)
--D
Quoted 7 lines
tests/generic/388 +1
-0+ fi done # success, all doneSignature · 1 line
2.26.2
Quoted 44 lines · Darrick J. Wong
Quoted 30 lines · Brian Foster
XFS has an issue where superblock counters may not be properly synced when recovery occurs via a read-only mount. This causes the filesystem to become inconsistent after unmount. To cover this test case, update generic/388 to switch between read-only and read-write mounts to perform log recovery.
Signed-off-by Brian Foster <[email protected]>---
I didn't think it was worth duplicating generic/388 to a whole new test just to invoke log recovery from a read-only mount. generic/388 is a rather general log recovery test and this preserves historical behavior of the test.
A prospective fix for the issue this reproduces on XFS is posted here:
https://lore.kernel.org/linux-xfs/[email protected]/
Brian
tests/generic/388 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)tests/generic/388 +0
-0@@ -66,8 +66,14 @@ for i in $(seq 1 $((50 * TIME_FACTOR)) ); do ps -e | grep fsstress > /dev/null 2>&1 donetests/generic/388 for i in $(seq 1 $((50 * TIME_FACTOR)) ); do · line 75
Quoted 10 lines
tests/generic/388 +7
-2- # quit if mount fails so we don't shutdown the host fs - _scratch_cycle_mount || _fail "cycle mount failed" + # Toggle between rw and ro mounts for recovery. Quit if any mount + # attempt fails so we don't shutdown the host fs. + if [ $((RANDOM % 2)) -eq 0 ]; then + _scratch_cycle_mount || _fail "cycle mount failed" + else + _scratch_cycle_mount "ro" || _fail "cycle ro mount failed" + _scratch_cycle_mount || _fail "cycle mount failed"I would change that third failure message to something distinct, like:
Quoted 5 lines
_fail"cycle remount failed"To give us extra clues as to which branch encountered failure. This looks like a fun way to find new bugs. :)
Sure.. I tweaked it to "cycle rw mount failed" so it's distinct, yet more consistent with the preceding ro cycle.
Brian
Quoted 10 lines
--D
Quoted 7 lines
tests/generic/388 +1
-0+ fi done # success, all doneSignature · 1 line
2.26.2