From: Chao Yu <chao@kernel.org>
To: Nanzhe Zhao <zhaonanzhe@xiaomi.com>,
linux-f2fs-devel@lists.sourceforge.net,
Jaegeuk Kim <jaegeuk@kernel.org>
Cc: chao@kernel.org, Barry Song <baohua@kernel.org>, stable@vger.kernel.org
Subject: Re: [PATCH v2] f2fs: remove mappedtodisk flag usage in mmap write path
Date: Sun, 11 Oct 2026 15:12:27 +0800 [thread overview]
Message-ID: <97c38f99-76ca-4e2d-8f2a-a47047d78ab2@kernel.org> (raw)
In-Reply-To: <20261011040232.2940423-1-zhaonanzhe@xiaomi.com>
On 10/11/26 12:02, Nanzhe Zhao wrote:
> PG_mappedtodisk was inherited from the nobh/buffer-head era. However,
> f2fs has no buffer heads and the flag is no longer meaningful. The only
> user of the flag is the "no holes" shortcut in f2fs_vm_page_mkwrite(),
> which makes mmap write faults skip marking the folio dirty. Chao Yu
> pointed out that this is not only a cleanup: it causes the following
> race condition with filesystem freezing:
>
> CPU0 (write fault) CPU1 (freeze_super)
> ---- ----
> f2fs_vm_page_mkwrite()
> sb_start_pagefault()
> /* shortcut: no dirty */
> sb_end_pagefault()
>
> sb_wait_write(SB_FREEZE_PAGEFAULT)
> /* no waiter, passes */
> sync_filesystem()
> /* folio not dirty, skipped */
>
> finish_fault()
> /* PTE writable */
> fault_dirty_shared_page()
> folio_mark_dirty()
> /* dirty folio on a frozen fs */
>
> It will also skip APP_MAPPED_IO iostat/REQ_TIME updates and post-EOF
> folio zeroing.
>
> Remove this shortcut in f2fs_vm_page_mkwrite() and stop setting it in
> f2fs_read_single_page().
>
> Reported-by: Chao Yu <chao@kernel.org>
> Link: https://lore.kernel.org/linux-f2fs-devel/496b913c-eb81-4fa8-be72-c6a06a10aba2@kernel.org/
> Fixes: fbfa2cc58d53 ("f2fs: add file operations")
> Cc: stable@vger.kernel.org
> Signed-off-by: Nanzhe Zhao <zhaonanzhe@xiaomi.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
next prev parent reply other threads:[~2026-10-11 7:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-11 4:02 [PATCH v2] f2fs: remove mappedtodisk flag usage in mmap write path Nanzhe Zhao
2026-10-11 7:12 ` Chao Yu [this message]
2026-10-11 7:47 ` Barry Song
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=97c38f99-76ca-4e2d-8f2a-a47047d78ab2@kernel.org \
--to=chao@kernel.org \
--cc=baohua@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=stable@vger.kernel.org \
--cc=zhaonanzhe@xiaomi.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