linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 0/7] btrfs: check: Check and repair invalid free space cahce inode mode
Date: Mon, 25 Mar 2019 16:22:46 +0800	[thread overview]
Message-ID: <20190325082253.19583-1-wqu@suse.com> (raw)

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


             reply	other threads:[~2019-03-25  8:23 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-25  8:22 Qu Wenruo [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190325082253.19583-1-wqu@suse.com \
    --to=wqu@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).