mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] f2fs: fix to fetch ino via ino_of_node() under cache lock
@ 2026-10-23 12:35 Chao Yu
  2026-10-23 12:35 ` [PATCH 2/2] f2fs: fix to call f2fs_commit_super() correctly Chao Yu
  0 siblings, 1 reply; 2+ messages in thread
From: Chao Yu @ 2026-10-23 12:35 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-f2fs-devel, linux-kernel, Chao Yu, stable

From: Chao Yu <chao@kernel.org>

In f2fs_writeback_node_caches(), it's better to fetch ino via ino_of_node()
under cache lock, otherwise, node cache content may become stale after cache
is unlocked due to racing w/ truncation.

Commit 493b9dc8b52c ("f2fs: cache: use node cache") fixes similar issue in
f2fs_flush_inline_data() introduced in commit 34c061ad85a2 ("f2fs: Avoid double
lock for cp_rwsem during checkpoint").

Cc: stable@kernel.org
Fixes: 2049d4fcb057 ("f2fs: avoid multiple node page writes due to inline_data")
Signed-off-by: Chao Yu <chao@kernel.org>
---
 fs/f2fs/node.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 424e95ca5878..44f94000d452 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -2195,9 +2195,11 @@ int f2fs_writeback_node_caches(struct f2fs_sb_info *sbi, long nr_to_write,
 
 			/* flush inline_data */
 			if (f2fs_cache_test_inline(entry)) {
+				nid_t ino = ino_of_node(sbi, entry);
+
 				f2fs_cache_clear_inline(entry);
 				f2fs_unlock_cache(entry);
-				flush_inline_data(sbi, ino_of_node(sbi, entry));
+				flush_inline_data(sbi, ino);
 				goto lock_node;
 			}
 
-- 
2.49.0


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

* [PATCH 2/2] f2fs: fix to call f2fs_commit_super() correctly
  2026-10-23 12:35 [PATCH 1/2] f2fs: fix to fetch ino via ino_of_node() under cache lock Chao Yu
@ 2026-10-23 12:35 ` Chao Yu
  0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2026-10-23 12:35 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-f2fs-devel, linux-kernel, Chao Yu, stable

From: Chao Yu <chao@kernel.org>

This patch fixes the bug reported by Sashiko:

We should call f2fs_commit_super() instead of __f2fs_commit_super() in
sanity_check_area_boundary() to update chksum valud along w/
raw_super->segment_count.

Cc: stable@kernel.org
Fixes: d440c52d3151 ("f2fs: support superblock checksum")
Signed-off-by: Chao Yu <chao@kernel.org>
---
 fs/f2fs/super.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index b321b9cff351..da1e4bc8a64f 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -4090,12 +4090,12 @@ static inline bool sanity_check_area_boundary(struct f2fs_sb_info *sbi,
 			res = "internally";
 		} else {
 			/*
-			 * __f2fs_commit_super() will access log_blocksize
+			 * f2fs_commit_super() will access log_blocksize
 			 * in SECTOR_FROM_BLOCK(), init it in advance.
 			 */
 			sbi->log_blocksize =
 				le32_to_cpu(raw_super->log_blocksize);
-			err = __f2fs_commit_super(sbi, folio, index, false);
+			err = f2fs_commit_super(sbi, false);
 			res = err ? "failed" : "done";
 		}
 		f2fs_info(sbi, "Fix alignment : %s, start(%u) end(%llu) block(%u)",
-- 
2.49.0


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

end of thread, other threads:[~2026-10-23 12:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-23 12:35 [PATCH 1/2] f2fs: fix to fetch ino via ino_of_node() under cache lock Chao Yu
2026-10-23 12:35 ` [PATCH 2/2] f2fs: fix to call f2fs_commit_super() correctly Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®