From: Chao Yu <chao@kernel.org>
To: Yongpeng Yang <monty_pavel@sina.com>, Jaegeuk Kim <jaegeuk@kernel.org>
Cc: chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net,
Yongpeng Yang <yangyongpeng@xiaomi.com>,
stable@vger.kernel.org
Subject: Re: [PATCH] f2fs: fix node_cnt race between extent node destroy and writeback
Date: Mon, 13 Apr 2026 19:23:46 +0800 [thread overview]
Message-ID: <6e33b6f1-7d05-4edd-87f9-28a2a98a6b27@kernel.org> (raw)
In-Reply-To: <20260403144015.221811-3-monty_pavel@sina.com>
On 4/3/2026 10:40 PM, Yongpeng Yang wrote:
> From: Yongpeng Yang <yangyongpeng@xiaomi.com>
>
> f2fs_destroy_extent_node() does not set FI_NO_EXTENT before clearing
> extent nodes. When called from f2fs_drop_inode() with I_SYNC set,
> concurrent kworker writeback can insert new extent nodes into the same
> extent tree, racing with the destroy and triggering f2fs_bug_on() in
> __destroy_extent_node(). The scenario is as follows:
>
> drop inode writeback
> - iput
> - f2fs_drop_inode // I_SYNC set
> - f2fs_destroy_extent_node
> - __destroy_extent_node
> - while (node_cnt) {
> write_lock(&et->lock)
> __free_extent_tree
> write_unlock(&et->lock)
> - __writeback_single_inode
> - f2fs_outplace_write_data
> - f2fs_update_read_extent_cache
> - __update_extent_tree_range
> // FI_NO_EXTENT not set,
> // insert new extent node
> } // node_cnt == 0, exit while
> - f2fs_bug_on(node_cnt) // node_cnt > 0
>
> Additionally, __update_extent_tree_range() only checks FI_NO_EXTENT for
> EX_READ type, leaving EX_BLOCK_AGE updates completely unprotected.
>
> This patch set FI_NO_EXTENT under et->lock in __destroy_extent_node(),
> consistent with other callers (__update_extent_tree_range and
> __drop_extent_tree) and check FI_NO_EXTENT for both EX_READ and
> EX_BLOCK_AGE tree.
>
> Fixes: 3fc5d5a182f6 ("f2fs: fix to shrink read extent node in batches")
> Cc: stable@vger.kernel.org
> Signed-off-by: Yongpeng Yang <yangyongpeng@xiaomi.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
next prev parent reply other threads:[~2026-04-13 11:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-03 14:40 [PATCH] f2fs: fix node_cnt race between extent node destroy and writeback Yongpeng Yang
2026-04-13 11:23 ` Chao Yu [this message]
2026-04-15 16:50 ` [f2fs-dev] " patchwork-bot+f2fs
2026-04-17 9:00 ` Chao Yu
2026-04-17 13:26 ` [f2fs-dev] " Yongpeng Yang
2026-04-18 0:51 ` Chao Yu
2026-04-18 16:29 ` Yongpeng Yang
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=6e33b6f1-7d05-4edd-87f9-28a2a98a6b27@kernel.org \
--to=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=monty_pavel@sina.com \
--cc=stable@vger.kernel.org \
--cc=yangyongpeng@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