If a nid is valid, the ino in its nat entry should record its parent nid.
However if the ino is zero, we should drop the node.

Signed-off-by: Sheng Yong <shengyo...@huawei.com>
Signed-off-by: Xue Liu <liuxueliu....@huawei.com>
---
 fsck/fsck.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fsck/fsck.c b/fsck/fsck.c
index 4fbb56d..c018d3a 100644
--- a/fsck/fsck.c
+++ b/fsck/fsck.c
@@ -342,6 +342,11 @@ static int sanity_check_nid(struct f2fs_sb_info *sbi, u32 
nid,
        }
 
        get_node_info(sbi, nid, ni);
+       if (ni->ino == 0) {
+               ASSERT_MSG("nid[0x%x] ino is 0", nid);
+               return -EINVAL;
+       }
+
        if (ni->blk_addr == NEW_ADDR) {
                ASSERT_MSG("nid is NEW_ADDR. [0x%x]", nid);
                return -EINVAL;
-- 
1.9.1


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to