public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] generic/388: randomly recover via read-only mounts
@ 2021-01-05 11:58 Brian Foster
  2021-01-05 17:31 ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Brian Foster @ 2021-01-05 11:58 UTC (permalink / raw)
  To: fstests; +Cc: linux-xfs

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 <bfoster@redhat.com>
---

v2:
- Tweak ro -> rw mount cycle error message to be unique.
v1: https://lore.kernel.org/fstests/20201217145941.2513069-1-bfoster@redhat.com/

 tests/generic/388 | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tests/generic/388 b/tests/generic/388
index 451a6be2..2f97f266 100755
--- a/tests/generic/388
+++ b/tests/generic/388
@@ -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
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] generic/388: randomly recover via read-only mounts
  2021-01-05 11:58 [PATCH v2] generic/388: randomly recover via read-only mounts Brian Foster
@ 2021-01-05 17:31 ` Darrick J. Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2021-01-05 17:31 UTC (permalink / raw)
  To: Brian Foster; +Cc: fstests, linux-xfs

On Tue, Jan 05, 2021 at 06:58:44AM -0500, Brian Foster wrote:
> 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 <bfoster@redhat.com>

Looks good to me,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
> 
> v2:
> - Tweak ro -> rw mount cycle error message to be unique.
> v1: https://lore.kernel.org/fstests/20201217145941.2513069-1-bfoster@redhat.com/
> 
>  tests/generic/388 | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/generic/388 b/tests/generic/388
> index 451a6be2..2f97f266 100755
> --- a/tests/generic/388
> +++ b/tests/generic/388
> @@ -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
> -- 
> 2.26.2
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-05 17:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-05 11:58 [PATCH v2] generic/388: randomly recover via read-only mounts Brian Foster
2021-01-05 17:31 ` Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox