From: Christoph Hellwig <hch@infradead.org>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org, hch@infradead.org
Subject: Re: [PATCH] btrfs: fix a race which can lead to unreported write failure
Date: Mon, 25 Sep 2023 01:57:33 -0700 [thread overview]
Message-ID: <ZRFLfTSMBXs+JTkc@infradead.org> (raw)
In-Reply-To: <8bc4c2aaa8d32ad92838b3778a85660ba7c6bfa8.1695617943.git.wqu@suse.com>
On Mon, Sep 25, 2023 at 02:29:28PM +0930, Qu Wenruo wrote:
> Thread A | Thread B
> ---------------------------------------+----------------------------------
> btrfs_orig_write_end_io() | btrfs_clone_write_end_io()
> | this bio failed | | this bio failed
> | | |
> |- atommic_inc(&bioc->error); | |
> |- atomic_read(&bioc->error) | |
> | So far we only hit one error, | |
> | thus can still consider the write | |
> | succeeded | |
> `- bio->bi_status = BLK_STS_OK; | |
> | `- atomic_inc(&bioc->error);
I don't think this scenario can happen.
btrfs_clone_write_end_io increments bioc->error before calling
bio_endio on the orig_bio, which is the earliest time
btrfs_orig_write_end_io will be called for this original bio due to
the earlier bio_inc_remaining.
next prev parent reply other threads:[~2023-09-25 8:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-25 4:59 [PATCH] btrfs: fix a race which can lead to unreported write failure Qu Wenruo
2023-09-25 8:57 ` Christoph Hellwig [this message]
2023-09-25 9:17 ` Qu Wenruo
2023-09-25 9:20 ` Christoph Hellwig
2023-09-25 9:39 ` Qu Wenruo
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=ZRFLfTSMBXs+JTkc@infradead.org \
--to=hch@infradead.org \
--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