All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Lowmem fsck repair to fix filetype mismatch
@ 2018-01-17  5:17 Qu Wenruo
  2018-01-17  5:17 ` [PATCH 1/3] btrfs-progs: lowmem fsck: Remove corupted link before re-add correct link Qu Wenruo
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Qu Wenruo @ 2018-01-17  5:17 UTC (permalink / raw)
  To: linux-btrfs; +Cc: dsterba

Sebastian reported a filesystem corruption where DIR_INDEX has wrong
filetype against INODE_ITEM.

Lowmem mode normally handles such problem by checking DIR_INDEX,
DIR_ITEM and INODE_REF/INODE_ITEM to determine the correct file type.
In such case, lowmem mode fsck can get the correct filetype.

When fixing the problem, lowmem mode will try to re-insert correct
(DIR_INDEX, DIR_ITEM, INODE_REF) tuple, and if existing correct
DIR_ITEM and INODE_REF is found, btrfs_link() will just skip and only
insert correct DIR_INDEX.

However, when inserting correct DIR_INDEX, due to extra DIR_INDEX
validation, incorrect one will be skiped and correct one will be
inserted after invalid one.

This leads to lowmem mode repair to create duplicated DIR_INDEX.

This patch will fix it by removing the whole (DIR_INDEX, DIR_ITEM,
INODE_REF) tuple before inserting correct tuple.
And the removing part, btrfs_unlink(), will be enhanced to handle
incorrect tuple member more robust.

Please note that, due a bug in lowmem mode repair, btrfs check will
still show "error(s) found in fs tree" even repair is done successfully.

And test case for this repair still needs extra work for original mode
to support such repair, or test case won't pass original mode test.

Qu Wenruo (3):
  btrfs-progs: lowmem fsck: Remove corupted link before re-add correct
    link
  btrfs-progs: dir-item: Allow dir item and dir index lookup to ignore
    found problem
  btrfs-progs: dir-item: Make btrfs_delete_one_dir_name more robust to
    handle corrupted name len

 cmds-check.c   |  6 +++++-
 convert/main.c |  2 +-
 ctree.h        |  4 ++--
 dir-item.c     | 45 +++++++++++++++++++++++++++++++++++----------
 inode.c        | 14 +++++++-------
 5 files changed, 50 insertions(+), 21 deletions(-)

-- 
2.15.1


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

end of thread, other threads:[~2018-05-07 17:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-17  5:17 [PATCH 0/3] Lowmem fsck repair to fix filetype mismatch Qu Wenruo
2018-01-17  5:17 ` [PATCH 1/3] btrfs-progs: lowmem fsck: Remove corupted link before re-add correct link Qu Wenruo
2018-01-17 13:40   ` Nikolay Borisov
2018-01-17  5:17 ` [PATCH 2/3] btrfs-progs: dir-item: Allow dir item and dir index lookup to ignore found problem Qu Wenruo
2018-01-17 13:13   ` Nikolay Borisov
2018-01-17 14:23     ` Qu Wenruo
2018-01-17 14:29       ` Nikolay Borisov
2018-01-17  5:17 ` [PATCH 3/3] btrfs-progs: dir-item: Make btrfs_delete_one_dir_name more robust to handle corrupted name len Qu Wenruo
2018-01-17 13:39   ` Nikolay Borisov
2018-05-07 17:52 ` [PATCH 0/3] Lowmem fsck repair to fix filetype mismatch David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.