fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Shiyang Ruan <ruansy.fnst@fujitsu.com>
Cc: fstests@vger.kernel.org
Subject: Re: [PATCH] generic/670: allow _mread_range() races with reflink_range()
Date: Thu, 13 Jan 2022 13:09:32 -0800	[thread overview]
Message-ID: <20220113210932.GA19171@magnolia> (raw)
In-Reply-To: <20220112092846.1467088-1-ruansy.fnst@fujitsu.com>

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
> 
> 
> 

      reply	other threads:[~2022-01-13 21:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220113210932.GA19171@magnolia \
    --to=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=ruansy.fnst@fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).