btrfs-progs: check: lowmem: Fix false alert about orphan inode
authorQu Wenruo <wqu@suse.com>
Mon, 5 Feb 2018 06:47:11 +0000 (14:47 +0800)
committerDavid Sterba <dsterba@suse.com>
Fri, 30 Mar 2018 20:15:54 +0000 (22:15 +0200)
commit8d6c4447823fa73e928e43f3c2f90f1da0ad5a47
treed04711931d6aeee5cbb6533461966f2f0f83ea35
parent89f5a8f97ca8c53759a1dcd8117808db2086643f
btrfs-progs: check: lowmem: Fix false alert about orphan inode

Btrfs can delay inode deletion and in that case btrfs will unlink the
victim inode from its parent dir, and insert a marker to info btrfs to
delete it later.

In that case, such victim inode will have nlinks == 0, but is still
completely valid.
Original mode won't report such problem, but lowmem mode doesn't check
the ORPHAN_ITEM key for such inode, and can report false alert like:
------
ERROR: root 257 INODE[28891726] is orphan item
------

Fix such false alert by checking orphan item for inode whose nlink is 0.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Su Yue <suy.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
check/mode-lowmem.c