This patchset can be fetched from github: https://github.com/adam900710/btrfs-progs/tree/free_space_cache_imode_fix Which is based on v4.20.2 tag.
There is a minor problem reported in mail list where invalid inode mode (0) can sneak into free space cache inodes: item 9 key (256 INODE_ITEM 0) itemoff 13702 itemsize 160 generation 30 transid 30 size 65536 nbytes 1507328 block group 0 mode 0 links 1 uid 0 gid 0 rdev 0 sequence 23 flags 0x1b(NODATASUM|NODATACOW|NOCOMPRESS|PREALLOC) atime 0.0 (1970-01-01 08:00:00) ctime 1553491158.189771625 (2019-03-25 13:19:18) mtime 0.0 (1970-01-01 08:00:00) otime 0.0 (1970-01-01 08:00:00) Kernel free space cache code doesn't realy care about the inode mode, but tree-checker inode item checker cares and will report this as big problem, rejecting the image. I didn't see any reason to make inode item checker any less strict, as there is already fuzzed image can break kernel using invalid inode mode. So here I just enhance btrfs-progs before strict inode item checker lands. Next time when users report kernel rejecting previously valid fs, they should have a way to fix it in btrfs-progs. Changelog: v2: - Minor refactor to make common code more common. Qu Wenruo (7): btrfs-progs: check/lowmem: Add inode mode check btrfs-progs: check/original: Add inode mode check btrfs-progs: check/lowmem: Repair invalid inode mode in root tree btrfs-progs: check/original: Repair invalid inode mode in root tree btrfs: check/lowmem: Check and repair free space cache inode mode btrfs: check/original: Check and repair free space cache inode item btrfs: tests/fsck: Add test image for free space cache mode repair check/main.c | 42 ++++++ check/mode-common.c | 129 ++++++++++++++++++ check/mode-common.h | 29 ++++ check/mode-lowmem.c | 22 +++ check/mode-lowmem.h | 3 + check/mode-original.h | 1 + .../test.raw.xz | Bin 0 -> 159128 bytes 7 files changed, 226 insertions(+) create mode 100644 tests/fsck-tests/038-bad-free-space-cache-inode-mode/test.raw.xz -- 2.21.0