Linux EXT4 FS development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Theodore Ts'o" <tytso@mit.edu>,
	"Ext4 Developers List" <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH 08/27] ext4: zero s_fc_replay_state in ext4_fc_replay_cleanup()
Date: Thu, 12 Nov 2026 04:16:43 +0000	[thread overview]
Message-ID: <sashiko-outbox-210317@kernel.org> (raw)
In-Reply-To: <20261112040638.1576836-9-tytso@mit.edu>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] ext4: missing s_ea_inode_work flush before
  ext4_fc_replay_cleanup() [1]
--

commit a4ccfbc7c2db4e8403230f07464457a51d148eaa
Author: Theodore Ts'o <tytso@mit.edu>

ext4: zero s_fc_replay_state in ext4_fc_replay_cleanup()

This commit zeroes sbi->s_fc_replay_state in ext4_fc_replay_cleanup()
after freeing fc_regions and fc_modified_inodes so that repeated calls to
ext4_fc_replay_cleanup() are idempotent.

> diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c
> index 0cac890cf3702..15bd040c2329b 100644
> --- a/fs/ext4/fast_commit.c
> +++ b/fs/ext4/fast_commit.c
> @@ -2398,6 +2398,7 @@ void ext4_fc_replay_cleanup(struct super_block *sb)
>  	sbi->s_mount_state &= ~EXT4_FC_REPLAY;
>  	kfree(sbi->s_fc_replay_state.fc_regions);
>  	kfree(sbi->s_fc_replay_state.fc_modified_inodes);
> +	memset(&sbi->s_fc_replay_state, 0, sizeof(sbi->s_fc_replay_state));
>  }

[Severity: High]
This problem wasn't introduced by this patch, but can
ext4_fc_replay_cleanup() clear EXT4_FC_REPLAY before sbi->s_ea_inode_work
is flushed [1]?

When fast-commit replay unlinks an inode that owns an extended attribute
inode, ext4_xattr_inode_dec_ref_all() -> ext4_put_ea_inode() queues the EA
inode onto sbi->s_ea_inode_to_free and schedules sbi->s_ea_inode_work.
Unlike the failed_mount3a error path, the normal mount path in
__ext4_fill_super() calls ext4_fc_replay_cleanup() without flushing
sbi->s_ea_inode_work first, clearing EXT4_FC_REPLAY before ext4_mb_init()
initializes sbi->s_group_info:

fs/ext4/super.c:__ext4_fill_super() {
	...
	ext4_fc_replay_cleanup(sb);

	ext4_ext_init(sb);

	/* Register extent status tree shrinker */
	err = ext4_es_register_shrinker(sbi);
	if (err)
		goto failed_mount3;

	err = ext4_Inode_table_init(sb);
	...
	err = ext4_mb_init(sb);
	...
failed_mount3a:
	/* Drain deferred EA inode iputs from journal replay */
	flush_delayed_work(&sbi->s_ea_inode_work);
	ext4_fc_replay_cleanup(sb);
	...
}

If ext4_ea_inode_work() runs before ext4_mb_init() populates
sbi->s_group_info (or when mount failure jumps to failed_mount_wq after
ext4_mb_release()), ext4_evict_inode() -> ext4_free_inode() runs with
EXT4_FC_REPLAY cleared and ext4_get_group_info() returning NULL, which
triggers ext4_std_error(sb, -EFSCORRUPTED).

Should ext4_fc_replay_cleanup() (or __ext4_fill_super() right before it)
call flush_delayed_work(&sbi->s_ea_inode_work) before clearing
EXT4_FC_REPLAY?

[1] https://sashiko.dev/#/bug/linux-f893d2ed-6353-413a-8dd1-c6bc439b880a

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261112040638.1576836-1-tytso@mit.edu?part=8

  reply	other threads:[~2026-11-12  4:16 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12  4:06 [PATCH 00/27] ext4: add lots of KUnit tests! Theodore Ts'o
2026-11-12  4:06 ` [PATCH 01/27] ext4: add KUinit tests for fs/ext4/extents_status.c Theodore Ts'o
2026-11-12  4:18   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 02/27] ext4: add KUnit tests for fs/ext4/extents.c Theodore Ts'o
2026-11-12  4:28   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 03/27] ext4: add KUnit tests for ext4_ext_split() leaf and index splitting Theodore Ts'o
2026-11-12  4:15   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 04/27] ext4: add KUnit tests for fs/ext4/xattr.c Theodore Ts'o
2026-11-12  4:26   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 05/27] ext4: add KUnit tests for fs/ext4/namei.c Theodore Ts'o
2026-11-12  4:21   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 06/27] ext4: expand KUnit tests for fs/ext4/mballoc.c Theodore Ts'o
2026-11-12  4:26   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 07/27] ext4: add KUnit tests for fs/ext4/inline.c Theodore Ts'o
2026-11-12  4:29   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 08/27] ext4: zero s_fc_replay_state in ext4_fc_replay_cleanup() Theodore Ts'o
2026-11-12  4:16   ` sashiko-bot [this message]
2026-11-12  4:06 ` [PATCH 09/27] ext4: add KUnit tests for fs/ext4/fast_commit.c Theodore Ts'o
2026-11-12  4:28   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 10/27] ext4: expand KUnit tests for fs/ext4/inode.c Theodore Ts'o
2026-11-12  4:36   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 11/27] ext4: add KUnit tests for fs/ext4/ialloc.c Theodore Ts'o
2026-11-12  4:25   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 12/27] ext4: add KUnit tests for fs/ext4/balloc.c Theodore Ts'o
2026-11-12  4:16   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 13/27] ext4: add KUnit tests for fs/ext4/orphan.c Theodore Ts'o
2026-11-12  4:18   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 14/27] ext4: add KUnit tests for fs/ext4/block_validity.c Theodore Ts'o
2026-11-12  4:21   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 15/27] ext4: check multi-block overlap on left traversal in add_system_zone() Theodore Ts'o
2026-11-12  4:10   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 16/27] ext4: enable full feature coverage in fs/ext4/.kunitconfig Theodore Ts'o
2026-11-12  4:24   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 17/27] ext4: add KUnit tests for fs/ext4/super.c Theodore Ts'o
2026-11-12  4:27   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 18/27] ext4: add KUnit tests for fs/ext4/sysfs.c Theodore Ts'o
2026-11-12  4:32   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 19/27] ext4: add KUnit tests for fs/ext4/ioctl.c Theodore Ts'o
2026-11-12  4:35   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 20/27] ext4: add KUnit tests for fs/ext4/resize.c Theodore Ts'o
2026-11-12  4:34   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 21/27] ext4: add KUnit tests for fs/ext4/migrate.c Theodore Ts'o
2026-11-12  4:37   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 22/27] ext4: add KUnit tests for fs/ext4/indirect.c Theodore Ts'o
2026-11-12  4:46   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 23/27] ext4: expand KUnit tests in fs/ext4/extents-test.c for file range operations Theodore Ts'o
2026-11-12  4:34   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 24/27] ext4: add KUnit tests for fs/ext4/fsmap.c Theodore Ts'o
2026-11-12  4:30   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 25/27] ext4: add KUnit tests for fs/ext4/move_extent.c Theodore Ts'o
2026-11-12  4:36   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 26/27] ext4: add KUnit tests for fs/ext4/mmp.c Theodore Ts'o
2026-11-12  4:29   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 27/27] ext4: add KUnit tests for fs/ext4/dir.c Theodore Ts'o
2026-11-12  4:41   ` sashiko-bot

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=sashiko-outbox-210317@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tytso@mit.edu \
    /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