Re: [PATCH 0/3] btrfs-progs: Add check and repair for invalid inode generation

Ferry Toth
2019-10-18T20:48:48Z

Op 24-09-2019 om 10:11 schreef Qu Wenruo:
> We have at least two user reports about bad inode generation makes
> kernel reject the fs.

May I add my report? I just upgraded Ubuntu from 19.04 -> 19.10 so
kernel went from 5.0 -> 5.3 (but I was using 4.15 too).

Booting 5.3 leaves me in initramfs as I have /boot on @boot and / on /@

In initramfs I can try to mount but get something like
btrfs critical corrupt leaf invalid inode generation open_ctree failed

Booting old kernel works just as before, no errors.

> According to the creation time, the inode is created by some 2014
> kernel.

How do I get the creation time?

> And the generation member of INODE_ITEM is not updated (unlike the
> transid member) so the error persists until latest tree-checker detects.
>
> Even the situation can be fixed by reverting back to older kernel and
> copying the offending dir/file to another inode and delete the offending
> one, it still should be done by btrfs-progs.
>
How to find the offending dir/file from the command line manually?

> This patchset adds such check and repair ability to btrfs-check, with a
> simple test image.
>
> Qu Wenruo (3):
> btrfs-progs: check/lowmem: Add check and repair for invalid inode
> generation
> btrfs-progs: check/original: Add check and repair for invalid inode
> generation
> btrfs-progs: fsck-tests: Add test image for invalid inode generation
> repair
>
> check/main.c | 50 +++++++++++-
> check/mode-lowmem.c | 76 ++++++++++++++++++
> check/mode-original.h | 1 +
> .../.lowmem_repairable | 0
> .../bad_inode_geneartion.img.xz | Bin 0 -> 2012 bytes
> 5 files changed, 126 insertions(+), 1 deletion(-)
> create mode 100644 tests/fsck-tests/043-bad-inode-generation/.lowmem_repairable
> create mode 100644 tests/fsck-tests/043-bad-inode-generation/bad_inode_geneartion.img.xz
>