linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] btrfs: check: Check and repair invalid free space cahce inode mode
@ 2019-03-25  8:22 Qu Wenruo
  2019-03-25  8:22 ` [PATCH 1/7] btrfs-progs: check/lowmem: Add inode mode check Qu Wenruo
                   ` (6 more replies)
  0 siblings, 7 replies; 21+ messages in thread
From: Qu Wenruo @ 2019-03-25  8:22 UTC (permalink / raw)
  To: linux-btrfs

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.

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                                  |  36 +++++++
 check/mode-common.c                           |  48 +++++++++
 check/mode-common.h                           |  27 +++++
 check/mode-lowmem.c                           |  98 ++++++++++++++++++
 check/mode-lowmem.h                           |   3 +
 check/mode-original.h                         |   1 +
 .../test.raw.xz                               | Bin 0 -> 159128 bytes
 7 files changed, 213 insertions(+)
 create mode 100644 tests/fsck-tests/038-bad-free-space-cache-inode-mode/test.raw.xz

-- 
2.21.0


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

end of thread, other threads:[~2019-04-01  5:53 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-25  8:22 [PATCH 0/7] btrfs: check: Check and repair invalid free space cahce inode mode Qu Wenruo
2019-03-25  8:22 ` [PATCH 1/7] btrfs-progs: check/lowmem: Add inode mode check Qu Wenruo
2019-03-25 15:40   ` Nikolay Borisov
2019-03-25  8:22 ` [PATCH 2/7] btrfs-progs: check/original: " Qu Wenruo
2019-03-25 15:43   ` Nikolay Borisov
2019-03-25 22:59     ` Qu Wenruo
2019-03-25  8:22 ` [PATCH 3/7] btrfs-progs: check/lowmem: Repair invalid inode mode in root tree Qu Wenruo
2019-03-29  9:36   ` Nikolay Borisov
2019-03-29 11:00     ` Qu Wenruo
2019-03-25  8:22 ` [PATCH 4/7] btrfs-progs: check/original: " Qu Wenruo
2019-03-25  8:22 ` [PATCH 5/7] btrfs: check/lowmem: Check and repair free space cache inode mode Qu Wenruo
2019-03-25 14:36   ` Su Yue
2019-03-25 14:39     ` Qu Wenruo
2019-03-29  9:40   ` Nikolay Borisov
2019-03-29 11:02     ` Qu Wenruo
2019-03-29 11:47       ` Nikolay Borisov
2019-03-25  8:22 ` [PATCH 6/7] btrfs: check/original: Check and repair free space cache inode item Qu Wenruo
2019-03-25  8:22 ` [PATCH 7/7] btrfs: tests/fsck: Add test image for free space cache mode repair Qu Wenruo
2019-03-29 12:05   ` Nikolay Borisov
2019-03-29 12:08     ` Qu Wenruo
2019-04-01  5:52     ` 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).