public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: refactor how we prepare pages for btrfs_buffered_write()
Date: Thu, 13 Aug 2020 13:22:16 +0200	[thread overview]
Message-ID: <20200813112216.GF2026@twin.jikos.cz> (raw)
In-Reply-To: <c0f45593-5733-29f1-e86e-cfa18091f470@suse.com>

On Thu, Aug 13, 2020 at 07:16:48PM +0800, Qu Wenruo wrote:
> > @@ -1763,11 +1771,9 @@ static noinline ssize_t btrfs_buffered_write(struct kiocb *iocb,
> >  			nrptrs = 1;
> >  
> >  		if (copied == 0) {
> > -			force_page_uptodate = true;
> 
> This is here to prevent the following problem:
> 
> One page is completely covered by write range, but the write range
> inside the page is split into two iov.
> 
> In that case, if the later part failed to be copied, we will hit a short
> write.
> Originally we will set force_page_uptodate, then falls back to nrptrs =
> 1; with force_page_uptodate = true;
> 
> Then in the next loop, we will force to read that full page to avoid
> garbage in the partial written page.
> 
> This is indeed super rare, thus all my fstests run haven't triggered it.
> But in theory, as long as we have differnt iovs supported, it should
> still be possible.

I wouldn't count on fstests to trigger corner cases, for that we need
long running stress tests. Good that you can identify the rare cases
while the patch is still in development, catching such bugs later is
much harder.

      reply	other threads:[~2020-08-13 11:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-07  7:27 [PATCH] btrfs: refactor how we prepare pages for btrfs_buffered_write() Qu Wenruo
2020-08-13 11:16 ` Qu Wenruo
2020-08-13 11:22   ` David Sterba [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=20200813112216.GF2026@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wqu@suse.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