Skip to contentSkip to conversation

generic/388: randomly recover via read-only mounts

PATCH In review Brian Foster 2 participants 2 messages Jan 5, 2021

lore
Share & tools
lore
#0 lore raw

PATCH v2 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.

---

v2:
- Tweak ro -> rw mount cycle error message to be unique.
v1: https://lore.kernel.org/fstests/[email protected]/

 tests/generic/388 | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
tests/generic/388 +8 -2
index 451a6be2..2f97f266 100755
@@ -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 rw mount failed"
+	fi
 done
 
 # success, all done
Signature · 1 line
2.26.2
Reviewed-by on v2 1/1
#1 lore raw
Quoted 7 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.

Looks good to me,

--D

Quoted 33 lines

---

v2:
- Tweak ro -> rw mount cycle error message to be unique.
v1: https://lore.kernel.org/fstests/[email protected]/

 tests/generic/388 | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
tests/generic/388 +8 -2
index 451a6be2..2f97f266 100755
@@ -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 rw mount failed"
+	fi
 done
 
 # success, all done
Signature · 1 line
2.26.2