fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] generic/670: allow _mread_range() races with reflink_range()
@ 2022-01-12  9:28 Shiyang Ruan
  2022-01-13 21:09 ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Shiyang Ruan @ 2022-01-12  9:28 UTC (permalink / raw)
  To: fstests; +Cc: ruansy.fnst, Darrick J . Wong

mread copies data one-byte-at-a-time, so it may races with
reflink_range() who invalidates page cache of the dest file.
Allow this race by adjusting the egrep regexp.

Reported-by: Darrick J. Wong <djwong@kernel.org>
Suggested-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Shiyang Ruan <ruansy.fnst@fujitsu.com>
---
 tests/generic/670 | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/generic/670 b/tests/generic/670
index 83fbd0b9..4a895d90 100755
--- a/tests/generic/670
+++ b/tests/generic/670
@@ -40,7 +40,10 @@ _cp_reflink $testdir/file1 $testdir/file3
 _scratch_cycle_mount
 
 fbytes() {
-	egrep -v '(61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61|62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62)'
+	# Different with generic/164,165, mread copies data from mmapped area
+	# one-byte-at-a-time, which may cause races during reflink_range().
+	# So the result of _mread_range() may be a mix of 61 and 62.
+	egrep -v '((61|62) ){15}(61|62)'
 }
 
 reader() {
-- 
2.34.1




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

* Re: [PATCH] generic/670: allow _mread_range() races with reflink_range()
  2022-01-12  9:28 [PATCH] generic/670: allow _mread_range() races with reflink_range() Shiyang Ruan
@ 2022-01-13 21:09 ` Darrick J. Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2022-01-13 21:09 UTC (permalink / raw)
  To: Shiyang Ruan; +Cc: fstests

On Wed, Jan 12, 2022 at 05:28:46PM +0800, Shiyang Ruan wrote:
> mread copies data one-byte-at-a-time, so it may races with
> reflink_range() who invalidates page cache of the dest file.
> Allow this race by adjusting the egrep regexp.
> 
> Reported-by: Darrick J. Wong <djwong@kernel.org>
> Suggested-by: Darrick J. Wong <djwong@kernel.org>
> Signed-off-by: Shiyang Ruan <ruansy.fnst@fujitsu.com>

Looks reasonable; I'll put this in the test system for tonight and
report back if I see anything strange.  I didn't see anything obvious
after a dozen or so rounds.

Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  tests/generic/670 | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/generic/670 b/tests/generic/670
> index 83fbd0b9..4a895d90 100755
> --- a/tests/generic/670
> +++ b/tests/generic/670
> @@ -40,7 +40,10 @@ _cp_reflink $testdir/file1 $testdir/file3
>  _scratch_cycle_mount
>  
>  fbytes() {
> -	egrep -v '(61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61|62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62)'
> +	# Different with generic/164,165, mread copies data from mmapped area
> +	# one-byte-at-a-time, which may cause races during reflink_range().
> +	# So the result of _mread_range() may be a mix of 61 and 62.
> +	egrep -v '((61|62) ){15}(61|62)'
>  }
>  
>  reader() {
> -- 
> 2.34.1
> 
> 
> 

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

end of thread, other threads:[~2022-01-13 21:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-12  9:28 [PATCH] generic/670: allow _mread_range() races with reflink_range() Shiyang Ruan
2022-01-13 21:09 ` 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;
as well as URLs for NNTP newsgroup(s).