Thread (4 messages) 4 messages, 4 authors, 2021-07-21

Re: [PATCH v4] btrfs: rescue: allow ibadroots to skip bad extent tree when reading block group items

From: David Sterba <hidden>
Date: 2021-07-21 17:35:51

On Mon, Jul 19, 2021 at 01:43:04PM +0800, Qu Wenruo wrote:
When extent tree gets corrupted, normally it's not extent tree root, but
one toasted tree leaf/node.

In that case, rescue=ibadroots mount option won't help as it can only
handle the extent tree root corruption.

This patch will enhance the behavior by:

- Allow fill_dummy_bgs() to ignore -EEXIST error

  This means we may have some block group items read from disk, but
  then hit some error halfway.

- Fallback to fill_dummy_bgs() if any error gets hit in
  btrfs_read_block_groups()

  Of course, this still needs rescue=ibadroots mount option.

With that, rescue=ibadroots can handle extent tree corruption more
gracefully and allow a better recover chance.

Reported-by: Zhenyu Wu <redacted>
Link: https://www.spinics.net/lists/linux-btrfs/msg114424.html
Signed-off-by: Qu Wenruo <redacted>
---
Changelog:
v2:
- Don't try to fill with dummy block groups when we hit ENOMEM
v3:
- Remove a dead condition
  The empty fs_info->extent_root case has already been handled.
v4:
- Skip to next block group if we hit EEXIST when inserting the block
  group cache
Added to misc-next, thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help