linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8] btrfs: Error handling fixes
@ 2011-08-18 21:56 Mark Fasheh
  2011-08-18 21:56 ` [PATCH 1/8] btrfs: Don't BUG_ON errors from btrfs_create_subvol_root() Mark Fasheh
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: Mark Fasheh @ 2011-08-18 21:56 UTC (permalink / raw)
  To: linux-btrfs; +Cc: chris.mason

Hi,

The following are assorted fixes to error handling from all parts of the
Btrfs code.  Every patch in this series stands on it's own, with the
exception of the last patch which relies on the one before it (so patches 7
and 8 can be considered a pair).  I also included in this series an
uncommited patch from Tsutomu Itoh which was a better version of a patch I
had written. He should be cc'd on that mail.

For the most part, I'm still concentrating on eliminating sites where we
BUG_ON(ret) instead of bubbling errors up the stack. The patches were
tested using some simple file system commands and a background kernel build.

A git branch with these patches is available:

git://git.kernel.org/pub/scm/linux/kernel/git/mfasheh/btrfs-error-handling.git for_mason


Thanks,
	--Mark

^ permalink raw reply	[flat|nested] 10+ messages in thread
* [PATCH 0/8] btrfs: error handling fixes
@ 2024-12-08  2:50 Qu Wenruo
  0 siblings, 0 replies; 10+ messages in thread
From: Qu Wenruo @ 2024-12-08  2:50 UTC (permalink / raw)
  To: linux-btrfs

I believe there is a regression in the last 2 or 3 releases where
metadata/data space reservation code is no longer working properly,
result us to hit -ENOSPC during btrfs_run_delalloc_range().

One of the most common situation to hit such problem is during
generic/750, along with other long running generic tests.

Although I should start bisecting the space reservation bug, but I can
not help fixing the exposed bugs first.

This exposed quite some long existing bugs, all in the error handling
paths, that can lead to the following crashes

- Double ordered extent accounting
  Triggers WARN_ON_OCE() inside can_finish_ordered_extent() then crash.

  This bug is fixed by the first 3 patches.

- Subpage ASSERT() triggered, where subpage folio bitmap differs from
  folio status
  This happens most likey in submit_uncompressed_range(), where it
  unlock the folio without updating the subpage bitmaps.

  This bug is fixed by the 3rd patch.

- WARN_ON() if out-of-tree patch "btrfs: reject out-of-band dirty folios
  during writeback" applied
  This is a more complex case, where error handling leaves some folios
  dirty, but with EXTENT_DELALLOC flag cleared from extent io tree.

  Such dirty folios are still possible to be written back later, but
  since there is no EXTENT_DELALLOC flag, it will be treat as
  out-of-band dirty flags and trigger COW fixup.

  This bug is fixed by the 4th and 5th patch

With so many existing bugs exposed, there is more than enough motivation
to make btrfs_run_delalloc_range() (and its delalloc range functions)
output extra error messages so that at least we know something is wrong.

And those error messages have already helped a lot during my
development.

Patches 6~8 are here to enhance the error messages.

With all these patches applied, at least fstests can finish reliably,
otherwise it frequently crashes in generic tests that I was unable to
finish even one full run since the space reservation regression.

Qu Wenruo (8):
  btrfs: fix double accounting race when btrfs_run_delalloc_range()
    failed
  btrfs: fix double accounting race when extent_writepage_io() failed
  btrfs: fix the error handling of submit_uncompressed_range()
  btrfs: do proper folio cleanup when cow_file_range() failed
  btrfs: do proper folio cleanup when run_delalloc_nocow() failed
  btrfs: subpage: fix the bitmap dump for the locked flags
  btrfs: subpage: dump the involved bitmap when ASSERT() failed
  btrfs: add extra error messages for delalloc range related errors

 fs/btrfs/extent_io.c |  79 ++++++++++++++----
 fs/btrfs/inode.c     | 188 +++++++++++++++++++++++++++++++------------
 fs/btrfs/subpage.c   |  48 ++++++++---
 3 files changed, 234 insertions(+), 81 deletions(-)

-- 
2.47.1


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

end of thread, other threads:[~2024-12-08  2:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-18 21:56 [PATCH 0/8] btrfs: Error handling fixes Mark Fasheh
2011-08-18 21:56 ` [PATCH 1/8] btrfs: Don't BUG_ON errors from btrfs_create_subvol_root() Mark Fasheh
2011-08-18 21:56 ` [PATCH 2/8] btrfs: Don't BUG_ON() errors in update_ref_for_cow() Mark Fasheh
2011-08-18 21:56 ` [PATCH 3/8] btrfs: Don't BUG_ON kzalloc error in btrfs_lookup_csums_range() Mark Fasheh
2011-08-18 21:56 ` [PATCH 4/8] btrfs: make insert_ptr() void Mark Fasheh
2011-08-18 21:56 ` [PATCH 5/8] btrfs: Don't BUG_ON errors in __finish_chunk_alloc() Mark Fasheh
2011-08-18 21:56 ` [PATCH 6/8] btrfs: fix error check of btrfs_lookup_dentry() Mark Fasheh
2011-08-18 21:57 ` [PATCH 7/8] btrfs: make fixup_low_keys() void Mark Fasheh
2011-08-18 21:57 ` [PATCH 8/8] btrfs: make del_ptr() and btrfs_del_leaf() void Mark Fasheh
  -- strict thread matches above, loose matches on Subject: below --
2024-12-08  2:50 [PATCH 0/8] btrfs: error handling fixes Qu Wenruo

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