From: Zhiguo Niu <zhiguo.niu@unisoc.com>
To: <jaegeuk@kernel.org>, <chao@kernel.org>
Cc: zhiguo.niu@unisoc.com, niuzhiguo84@gmail.com,
linux-kernel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net
Subject: [f2fs-dev] [PATCH] f2fs: fix error path of __f2fs_build_free_nids
Date: Fri, 13 Oct 2023 18:58:23 +0800 [thread overview]
Message-ID: <1697194703-21371-1-git-send-email-zhiguo.niu@unisoc.com> (raw)
SBI_NEED_FSCK should be set for fsck has a chance to
repair in case of scan_nat_page fail in run time.
Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
---
fs/f2fs/node.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index ee2e1dd..d9e6087 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -2499,12 +2499,15 @@ static int __f2fs_build_free_nids(struct f2fs_sb_info *sbi,
ret = PTR_ERR(page);
} else {
ret = scan_nat_page(sbi, page, nid);
+ if (ret && !mount) {
+ set_sbi_flag(sbi, SBI_NEED_FSCK);
+ f2fs_err(sbi, "NAT is corrupt, run fsck to fix it");
+ }
f2fs_put_page(page, 1);
}
if (ret) {
f2fs_up_read(&nm_i->nat_tree_lock);
- f2fs_err(sbi, "NAT is corrupt, run fsck to fix it");
return ret;
}
}
--
1.9.1
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next reply other threads:[~2023-10-13 11:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-13 10:58 Zhiguo Niu [this message]
2023-10-16 7:37 ` [f2fs-dev] [PATCH] f2fs: fix error path of __f2fs_build_free_nids Chao Yu
2023-10-16 9:02 ` Zhiguo Niu
2023-10-16 9:06 ` Chao Yu
2023-10-16 9:16 ` Zhiguo Niu
2023-10-16 9:17 ` Chao Yu
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=1697194703-21371-1-git-send-email-zhiguo.niu@unisoc.com \
--to=zhiguo.niu@unisoc.com \
--cc=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=niuzhiguo84@gmail.com \
/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).