From: Sheng Yong <shengyong1@huawei.com>
To: jaegeuk@kernel.org, chao2.yu@samsung.com,
linux-f2fs-devel@lists.sourceforge.net
Cc: chengyinchao@huawei.com
Subject: [RFC PATCH] fsck.f2fs: fix corrupted nat entry [0]
Date: Tue, 23 Feb 2016 19:45:32 +0800 [thread overview]
Message-ID: <1456227932-29567-1-git-send-email-shengyong1@huawei.com> (raw)
The first nat entry must be null. If it is corrupted, we set its bit in
nat_area_bitmap, without increasing valid_nat_entry_cnt, fsck_verify will
nullify it at last.
Reported-by: Cheng Yinchao <chengyinchao@huawei.com>
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
---
fsck/mount.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/fsck/mount.c b/fsck/mount.c
index 4c807f9..ec040c8 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -1683,7 +1683,18 @@ void build_nat_area_bitmap(struct f2fs_sb_info *sbi)
&nat_block->entries[i]);
if (ni.blk_addr == 0)
continue;
- ASSERT(nid + i != 0x0);
+ if (nid + i == 0) {
+ /*
+ * nat entry [0] must be null. If
+ * it is corrupted, set its bit in
+ * nat_area_bitmap, fsck_verify will
+ * nullify it
+ */
+ ASSERT_MSG("Invalid nat entry[0]: blk_addr[0x%x]\n",
+ ni.blk_addr);
+ config.fix_on = 1;
+ fsck->chk.valid_nat_entry_cnt--;
+ }
DBG(3, "nid[0x%8x] addr[0x%16x] ino[0x%8x]\n",
nid + i, ni.blk_addr, ni.ino);
--
2.7.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=272487151&iu=/4140
reply other threads:[~2016-02-23 11:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1456227932-29567-1-git-send-email-shengyong1@huawei.com \
--to=shengyong1@huawei.com \
--cc=chao2.yu@samsung.com \
--cc=chengyinchao@huawei.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).