public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix another !PageUptodate related warning
@ 2022-02-11 16:24 Josef Bacik
  2022-02-11 16:24 ` [PATCH 1/2] btrfs: do not SetPageError on a read error for extent buffers Josef Bacik
  2022-02-11 16:24 ` [PATCH 2/2] btrfs: do not WARN_ON() if we have PageError set Josef Bacik
  0 siblings, 2 replies; 4+ messages in thread
From: Josef Bacik @ 2022-02-11 16:24 UTC (permalink / raw)
  To: linux-btrfs, kernel-team

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


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

end of thread, other threads:[~2022-02-14 11:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-11 16:24 [PATCH 0/2] Fix another !PageUptodate related warning Josef Bacik
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox