All of lore.kernel.org
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH v5 1/3] f2fs: fix to do sanity check on node footer in __write_node_folio()
@ 2026-01-12  7:49 ` Chao Yu
  0 siblings, 0 replies; 8+ messages in thread
From: Chao Yu via Linux-f2fs-devel @ 2026-01-12  7:49 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-kernel, linux-f2fs-devel

Add node footer sanity check during node folio's writeback, if sanity
check fails, let's shutdown filesystem to avoid looping to redirty
and writeback in .writepages.

Signed-off-by: Chao Yu <chao@kernel.org>
---
v5:
- split original [patch 1/2] to two, in this patch, just use
sanity_check_node_footer() to do sanity check during writeback.
 fs/f2fs/node.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 99e425e8c00a..bd4681a8a646 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1763,7 +1763,11 @@ static bool __write_node_folio(struct folio *folio, bool atomic, bool *submitted
 
 	/* get old block addr of this node page */
 	nid = nid_of_node(folio);
-	f2fs_bug_on(sbi, folio->index != nid);
+
+	if (sanity_check_node_footer(sbi, folio, nid, NODE_TYPE_REGULAR)) {
+		f2fs_handle_critical_error(sbi, STOP_CP_REASON_CORRUPTED_NID);
+		goto redirty_out;
+	}
 
 	if (f2fs_get_node_info(sbi, nid, &ni, !do_balance))
 		goto redirty_out;
-- 
2.40.1



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-01-19 13:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-12  7:49 [f2fs-dev] [PATCH v5 1/3] f2fs: fix to do sanity check on node footer in __write_node_folio() Chao Yu via Linux-f2fs-devel
2026-01-12  7:49 ` Chao Yu
2026-01-12  7:49 ` [f2fs-dev] [PATCH v5 2/3] f2fs: fix to do sanity check on node footer in {read, write}_end_io Chao Yu via Linux-f2fs-devel
2026-01-12  7:49   ` [PATCH v5 2/3] f2fs: fix to do sanity check on node footer in {read,write}_end_io Chao Yu
2026-01-12  7:49 ` [f2fs-dev] [PATCH v5 3/3] f2fs: detect more inconsistent cases in sanity_check_node_footer() Chao Yu via Linux-f2fs-devel
2026-01-12  7:49   ` Chao Yu
2026-01-19 13:50 ` [f2fs-dev] [PATCH v5 1/3] f2fs: fix to do sanity check on node footer in __write_node_folio() patchwork-bot+f2fs--- via Linux-f2fs-devel
2026-01-19 13:50   ` patchwork-bot+f2fs

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.