mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] f2fs: fix to record both APPEND and UPDATE ino entries
@ 2026-09-10  3:02 Zhiguo Niu
  2026-09-10  6:36 ` Chao Yu
  0 siblings, 1 reply; 2+ messages in thread
From: Zhiguo Niu @ 2026-09-10  3:02 UTC (permalink / raw)
  To: jaegeuk, chao
  Cc: linux-f2fs-devel, linux-kernel, niuzhiguo84, zhiguo.niu, ke.wang

In f2fs_post_evict_inode(), record_bits is assigned with BIT(APPEND_INO)
and BIT(UPDATE_INO) respectively, so the second assignment overwrites
the first one: when both FI_APPEND_WRITE and FI_UPDATE_WRITE are set,
only the UPDATE_INO entry is recorded.

The two flags are not mutually exclusive.Once the APPEND_INO entry is
lost after the inode eviction, the shortcut in f2fs_do_sync_file() can
take the flush_out path in the next fsync(), skipping f2fs_fsync_node_pages().
As a result, the dnodes holding the newly allocated blocks are not
fsync-marked, and after a sudden power loss, the data appended before the
eviction is silently lost.

This restores the previous behavior where the two ino entries were
added independently.

Fixes: 314c9e476ffc ("f2fs: call __add_ino_entry out of the eviction path")
Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
---
 fs/f2fs/inode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
index 82ebcb338b0c..c20fcd8c2b97 100644
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -1058,9 +1058,9 @@ static void f2fs_post_evict_inode(struct inode *inode)
 		goto skip_record;
 
 	if (is_inode_flag_set(inode, FI_APPEND_WRITE))
-		record_bits = BIT(APPEND_INO);
+		record_bits |= BIT(APPEND_INO);
 	if (is_inode_flag_set(inode, FI_UPDATE_WRITE))
-		record_bits = BIT(UPDATE_INO);
+		record_bits |= BIT(UPDATE_INO);
 
 	if (!record_bits)
 		goto skip_record;
-- 
2.43.0


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

end of thread, other threads:[~2026-09-10  6:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-10  3:02 [PATCH] f2fs: fix to record both APPEND and UPDATE ino entries Zhiguo Niu
2026-09-10  6:36 ` 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®