mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: Seungbum Ju <seungbum.ju@gmail.com>, Jaegeuk Kim <jaegeuk@kernel.org>
Cc: chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] f2fs: wait for node writeback on the first fsync after a checkpoint
Date: Wed, 11 Nov 2026 16:23:34 +0800	[thread overview]
Message-ID: <205eb014-0ebc-422f-8421-f9cf175acad7@kernel.org> (raw)
In-Reply-To: <20261103101208.4550-1-seungbum.ju@gmail.com>

On 11/3/26 18:12, Seungbum Ju wrote:
> f2fs_add_fsync_node_entry() numbers each fsync'd warm node page with
> sbi->fsync_seg_id++, and f2fs_reset_fsync_node_info() sets the counter back
> to 0 at every checkpoint. The first node page fsync'd after a checkpoint
> therefore gets seq_id 0, which f2fs_do_sync_file() passes to
> f2fs_wait_on_node_pages_writeback(). That function treats 0 as "nothing to
> wait for":
> 
>     while (seq_id && cur_seq_id < seq_id) {
> 
> so the fsync issues its cache flush without waiting for its own node page.
> If the flush completes before the node write, the inode's fsync-marked
> node block (needed by roll-forward recovery) is not covered by the flush,
> and a power loss can lose data that fsync reported as durable. In our
> traces the first fsync after a checkpoint returned before its node write
> completed in many trials.
> 
> Start the numbering at 1, so that 0 keeps meaning "no node page written".
> 
> Testing (kernel 7.0.0-42, f2fs built as a module from the same source,
> QEMU/KVM, block-layer FLUSH/FUA model with dm-log-writes replay):
> - block traces, append+fsync after sync: FLUSH issued before the node
>   write completed in 29/30 first fsyncs unpatched, 0/30 patched; never
>   for later fsyncs;
> - crash-state replay (28 cells x 3 recordings per module): SQLite
>   WAL/TRUNCATE/PERSIST, LevelDB, RocksDB, LMDB and an append log lose
>   acknowledged commits or become unopenable in 24 cells unpatched, and
>   are clean in all of them patched.
> 
> The same code is present in Android GKI android12-5.10 through
> android15-6.6 and in the f2fs dev tree as of 2026-11-02.
> 
> Fixes: 50fa53eccf9f ("f2fs: fix to avoid broken of dnode block list")
> Cc: stable@vger.kernel.org
> Signed-off-by: Seungbum Ju <seungbum.ju@gmail.com>
Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,

      reply	other threads:[~2026-11-11  8:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 10:12 Seungbum Ju
2026-11-11  8:23 ` Chao Yu [this message]

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=205eb014-0ebc-422f-8421-f9cf175acad7@kernel.org \
    --to=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=seungbum.ju@gmail.com \
    --cc=stable@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®