From: Sheng Yong <shengyong1@huawei.com>
To: jaegeuk@kernel.org, chao2.yu@samsung.com
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: [RFC PATCH 4/4] fsck.f2fs: check ino of an inode
Date: Sat, 30 Jan 2016 09:16:39 +0000 [thread overview]
Message-ID: <1454145399-30713-5-git-send-email-shengyong1@huawei.com> (raw)
In-Reply-To: <1454145399-30713-1-git-send-email-shengyong1@huawei.com>
If the node is an inode, its ino in the nat entry should be equal to the
ino in its node footer. Otherwise, we drop the file.
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Signed-off-by: Xue Liu <liuxueliu.liu@huawei.com>
---
fsck/fsck.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/fsck/fsck.c b/fsck/fsck.c
index c018d3a..312583e 100644
--- a/fsck/fsck.c
+++ b/fsck/fsck.c
@@ -372,6 +372,11 @@ static int sanity_check_nid(struct f2fs_sb_info *sbi, u32 nid,
le32_to_cpu(node_blk->footer.ino));
return -EINVAL;
}
+ if (ntype == TYPE_INODE && ni->ino != node_blk->footer.ino) {
+ ASSERT_MSG("nid[0x%x] TYPE_INODE nat_entry->ino[0x%x] footer.ino[0x%x]",
+ nid, ni->ino, le32_to_cpu(node_blk->footer.ino));
+ return -EINVAL;
+ }
if (ntype != TYPE_INODE &&
node_blk->footer.nid == node_blk->footer.ino) {
ASSERT_MSG("nid[0x%x] footer.nid[0x%x] footer.ino[0x%x]",
--
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
prev parent reply other threads:[~2016-01-30 1:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-30 9:16 [RFC PATCH 0/4] do more check in sanity_check_nid and clean up Sheng Yong
2016-01-30 9:16 ` [RFC PATCH 1/4] f2fs-tools: simplify get_{sb|cp} and set_{sb|cp} Sheng Yong
2016-01-30 1:46 ` Jaegeuk Kim
2016-01-30 2:25 ` Sheng Yong
2016-01-30 10:03 ` [RFC PATCH v2] " Sheng Yong
2016-02-02 0:27 ` [RFC PATCH 1/4] " Jaegeuk Kim
2016-01-30 9:16 ` [RFC PATCH 2/4] f2fs-tools: fix endianness of on-disk check_sum in summary_footer Sheng Yong
2016-01-30 9:16 ` [RFC PATCH 3/4] fsck.f2fs: check ino of an used nat entry Sheng Yong
2016-01-30 9:16 ` Sheng Yong [this message]
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=1454145399-30713-5-git-send-email-shengyong1@huawei.com \
--to=shengyong1@huawei.com \
--cc=chao2.yu@samsung.com \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
/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).