From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Guanghui Yang <3497809730@qq.com>, Chris Mason <clm@fb.com>,
David Sterba <dsterba@suse.com>
Cc: Qu Wenruo <wqu@suse.com>,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH v2] ext4: propagate errors from fast commit range replay
Date: Sun, 12 Jul 2026 12:49:50 +0930 [thread overview]
Message-ID: <7fdbed91-beb5-41c0-a181-e14a384c05b4@gmx.com> (raw)
In-Reply-To: <tencent_19048AD99E6321356E0F10A131F254603C08@qq.com>
在 2026/7/12 12:41, Guanghui Yang 写道:
> ext4_fc_replay() stops replaying fast commit tags only when a tag
> handler returns a negative error. However, ext4_fc_replay_add_range()
> and ext4_fc_replay_del_range() currently return 0 from their common
> exit paths even after internal failures.
>
> This hides errors from ext4_fc_record_modified_inode(),
> ext4_map_blocks(), ext4_find_extent(), ext4_ext_insert_extent(),
> ext4_ext_replay_update_ex(), and ext4_ext_remove_space(). As a result,
> a failed ADD_RANGE or DEL_RANGE replay can be treated as successful and
> the replay code may continue with subsequent fast commit tags.
>
> This is particularly problematic for DEL_RANGE because it may already
> have marked blocks as free before ext4_ext_remove_space() fails. If the
> error is swallowed, replay may continue from a partially applied range
> operation.
>
> Return the saved error from the common exit paths and make the
> ERR_PTR() cases in ADD_RANGE store PTR_ERR() before jumping to out.
>
> Fixes: 8016e29f4362 ("ext4: fast commit recovery path")
> Cc: stable@vger.kernel.org
> Fixes: 57a304cfd43b ("btrfs: do not panic in __add_reloc_root")
WTF? Stop hallucinate, no matter if it's from LLM or yourself.
How could a ext4 commit related to btrfs?
> Signed-off-by: Guanghui Yang <3497809730@qq.com>
> ---
> Changes in v2:
> - Add Fixes tag for the commit that made the duplicate-insert error path reachable.
>
> fs/ext4/fast_commit.c | 16 ++++++++++++----
> 1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c
> index 8e2259799614..fbb486d917b0 100644
> --- a/fs/ext4/fast_commit.c
> +++ b/fs/ext4/fast_commit.c
> @@ -2196,8 +2196,11 @@ static int ext4_fc_replay_add_range(struct super_block *sb, u8 *val)
> if (ret == 0) {
> /* Range is not mapped */
> path = ext4_find_extent(inode, cur, path, 0);
> - if (IS_ERR(path))
> + if (IS_ERR(path)) {
> + ret = PTR_ERR(path);
> + path = NULL;
> goto out;
> + }
> memset(&newex, 0, sizeof(newex));
> newex.ee_block = cpu_to_le32(cur);
> ext4_ext_store_pblock(
> @@ -2209,8 +2212,11 @@ static int ext4_fc_replay_add_range(struct super_block *sb, u8 *val)
> path = ext4_ext_insert_extent(NULL, inode,
> path, &newex, 0);
> up_write((&EXT4_I(inode)->i_data_sem));
> - if (IS_ERR(path))
> + if (IS_ERR(path)) {
> + ret = PTR_ERR(path);
> + path = NULL;
> goto out;
> + }
> goto next;
> }
>
> @@ -2257,10 +2263,11 @@ static int ext4_fc_replay_add_range(struct super_block *sb, u8 *val)
> }
> ext4_ext_replay_shrink_inode(inode, i_size_read(inode) >>
> sb->s_blocksize_bits);
> + ret = 0;
> out:
> ext4_free_ext_path(path);
> iput(inode);
> - return 0;
> + return ret;
> }
>
> /* Replay DEL_RANGE tag */
> @@ -2320,9 +2327,10 @@ ext4_fc_replay_del_range(struct super_block *sb, u8 *val)
> ext4_ext_replay_shrink_inode(inode,
> i_size_read(inode) >> sb->s_blocksize_bits);
> ext4_mark_inode_dirty(NULL, inode);
> + ret = 0;
> out:
> iput(inode);
> - return 0;
> + return ret;
> }
>
> static void ext4_fc_set_bitmaps_and_counters(struct super_block *sb)
next prev parent reply other threads:[~2026-07-12 3:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-11 15:41 [PATCH] btrfs: free mapping node on duplicate reloc root insert Guanghui Yang
2026-07-11 22:45 ` Qu Wenruo
2026-07-12 3:11 ` [PATCH v2] ext4: propagate errors from fast commit range replay Guanghui Yang
2026-07-12 3:19 ` Qu Wenruo [this message]
2026-07-12 3:27 ` Guanghui Yang
2026-07-12 3:17 ` [PATCH v2] btrfs: free mapping node on duplicate reloc root insert Guanghui Yang
2026-07-12 5:28 ` Qu Wenruo
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=7fdbed91-beb5-41c0-a181-e14a384c05b4@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=3497809730@qq.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=wqu@suse.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