Re: [PATCH] btrfs: Allow read-only mount with corrupted extent tree
From: Dāvis Mosāns
Date: Thu Aug 12 2021 - 13:18:37 EST
trešd., 2021. g. 11. aug., plkst. 23:41 — lietotājs Josef Bacik
(<josef@xxxxxxxxxxxxxx>) rakstīja:
>
> On 8/11/21 4:07 PM, Dāvis Mosāns wrote:
> > Currently if there's any corruption at all in extent tree
> > (eg. even single bit) then mounting will fail with:
> > "failed to read block groups: -5" (-EIO)
> > It happens because we immediately abort on first error when
> > searching in extent tree for block groups.
> >
> > Now with this patch if `ignorebadroots` option is specified
> > then we handle such case and continue by removing already
> > created block groups and creating dummy block groups.
> >
>
> Already done and queue'ed up for the next release
>
> btrfs: rescue: allow ibadroots to skip bad extent tree when reading block group
> items
Nice!
Originally I submitted this patch in March, but it went nowhere so resent.
Anyway I tested that other patch and it has limitation that it won't
handle log replay error so need to use both
rescue=ignorebadroots,nologreplay
But other than it seems to work fine.
Here's output when not using nologreplay
[ 1886.281376] BTRFS info (device sde): ignoring bad roots
[ 1886.281381] BTRFS info (device sde): disk space caching is enabled
[ 1886.281383] BTRFS info (device sde): has skinny extents
[ 1886.365608] BTRFS info (device sde): bdev /dev/sdq errs: wr 0, rd
0, flush 0, corrupt 473, gen 0
[ 1886.365618] BTRFS info (device sde): bdev /dev/sdi errs: wr 31626,
rd 18765, flush 178, corrupt 5841, gen 0
[ 1886.365623] BTRFS info (device sde): bdev /dev/sdo errs: wr 6867,
rd 2640, flush 178, corrupt 1066, gen 0
[ 1900.249267] BTRFS warning (device sde): checksum verify failed on
21057125941248 wanted 0x5a4526a7 found 0x25949991 level 0
[ 1902.323362] BTRFS error (device sde): parent transid verify failed
on 21057111523328 wanted 2262739 found 2262698
[ 1902.519338] BTRFS error (device sde): bad tree block start, want
21057108836352 have 524288
[ 1902.940022] BTRFS warning (device sde): checksum verify failed on
21057097302016 wanted 0x8b2501e9 found 0x5b8ab9a3 level 0
[ 1902.946715] BTRFS error (device sde): parent transid verify failed
on 21057097302016 wanted 2262739 found 2262696
[ 1902.950727] BTRFS info (device sde): start tree-log replay
[ 1911.289738] BTRFS warning (device sde): checksum verify failed on
21057127661568 wanted 0xd1506ed9 found 0x22ab750a level 0
[ 1911.293266] BTRFS warning (device sde): checksum verify failed on
21057107017728 wanted 0x9120eaee found 0x35b2df28 level 0
[ 1911.326093] BTRFS: error (device sde) in __btrfs_free_extent:3069:
errno=-5 IO failure
[ 1911.326101] BTRFS: error (device sde) in
btrfs_run_delayed_refs:2150: errno=-5 IO failure
[ 1911.326106] BTRFS warning (device sde): Skipping commit of aborted
transaction.
[ 1911.326108] BTRFS: error (device sde) in cleanup_transaction:1945:
errno=-5 IO failure
[ 1911.326190] BTRFS warning (device sde): checksum verify failed on
21057107017728 wanted 0x9120eaee found 0xd00e16cf level 0
[ 1911.326317] BTRFS warning (device sde): checksum verify failed on
21057107017728 wanted 0x9120eaee found 0xd00e16cf level 0
[ 1911.326922] BTRFS: error (device sde) in btrfs_replay_log:2417:
errno=-5 IO failure (Failed to recover log tree)
[ 1912.160913] BTRFS error (device sde): parent transid verify failed
on 21057111736320 wanted 2262739 found 2262698
[ 1914.666177] BTRFS error (device sde): open_ctree failed
Best regards,
Dāvis