From: Josef Bacik <josef@toxicpanda.com>
To: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: [PATCH 0/2] Fix another !PageUptodate related warning
Date: Fri, 11 Feb 2022 11:24:37 -0500 [thread overview]
Message-ID: <cover.1644596294.git.josef@toxicpanda.com> (raw)
We hit a warning in generic/281 in our overnight testing. This is the same
error that I thought I fixed with c2e39305299f01 ("btrfs: clear extent buffer
uptodate when we fail to write it"), however all I did was make the race window
much smaller.
The race is relatively simple
Task 1 Task 2
switch_commit_roots()
btrfs_search_slot(path->search_commit_root)
btrfs_write_and_wait_transaction()
start processing path->nodes[0]
write failure
end_bio_extent_buffer_writepage
ClearPageUptodate()
try to read from the extent buffer
trigger warning
There's no real way to stop this without adding some heavy handed locking in
here to make sure we don't invalidate an extent buffer while we're reading it.
And we can't really add more locking because this particular path uses
->skip_locking, so we'd have to be very intentional about what we're wanting to
do.
To fix this we need two things. First is to be consistent with how we use
PageError. Everybody uses it for writes, and in fact that's how we use it with
the exception of one error path on the extent buffer read. So first fix that so
we don't ever have PageError without a write error.
Secondly change assert_eb_page_uptodate() to only WARN_ON if !Uptodate &&
!Error, so we get a warning if we didn't properly read an extent buffer, but not
if we failed to write the buffer out. With this I'm now able to run 100 runs of
generic/281 without warnings, whereas before it reproduced in around 10 runs.
Thanks,
Josef
Josef Bacik (2):
btrfs: do not SetPageError on a read error for extent buffers
btrfs: do not WARN_ON() if we have PageError set
fs/btrfs/extent_io.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
--
2.26.3
next reply other threads:[~2022-02-11 16:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-11 16:24 Josef Bacik [this message]
2022-02-11 16:24 ` [PATCH 1/2] btrfs: do not SetPageError on a read error for extent buffers Josef Bacik
2022-02-14 10:47 ` Filipe Manana
2022-02-11 16:24 ` [PATCH 2/2] btrfs: do not WARN_ON() if we have PageError set Josef Bacik
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=cover.1644596294.git.josef@toxicpanda.com \
--to=josef@toxicpanda.com \
--cc=kernel-team@fb.com \
--cc=linux-btrfs@vger.kernel.org \
/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