All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Daejun Park" <daejun7.park@samsung.com>
Cc: tytso@mit.edu, linux-ext4@vger.kernel.org
Subject: Re: [PATCH 2/2] ext4: track zeroed out blocks of unwritten extents for fast commit
Date: Wed, 07 Oct 2026 00:55:24 +0000	[thread overview]
Message-ID: <sashiko-outbox-162556@kernel.org> (raw)
In-Reply-To: <20261007-ext4-fc-zeroout-v1-2-b86de6439431@samsung.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] ext4: missing ES tree update in ext4_split_extent_zeroout() causes stale fast commit logs
--

commit 9e702f427b4057cfc7aebd5f1480625ae8d66b78
Author: Daejun Park <daejun7.park@samsung.com>

ext4: track zeroed out blocks of unwritten extents for fast commit

When ext4_ext_convert_to_initialized() converts part of an unwritten
extent, it may zero out the blocks before and after that range and convert
them to written together with it. This patch tracks these zeroed out blocks
for fast commit in ext4_zeroout_es() and ext4_split_extent_zeroout().

Fixes: aa75f4d3daae ("ext4: main fast-commit commit path")

> diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> index d65e30f3c1a74..3b45b55931c2b 100644
> --- a/fs/ext4/extents.c
> +++ b/fs/ext4/extents.c
> @@ -3149,7 +3149,8 @@ void ext4_ext_release(struct super_block *sb)
>  #endif
>  }
>  
> -static void ext4_zeroout_es(struct inode *inode, struct ext4_extent *ex)
> +static void ext4_zeroout_es(handle_t *handle, struct inode *inode,
> +			    struct ext4_extent *ex)
>  {
>  	ext4_lblk_t  ee_block;
>  	ext4_fsblk_t ee_pblock;
> @@ -3164,6 +3165,12 @@ static void ext4_zeroout_es(struct inode *inode, struct ext4_extent *ex)
>  
>  	ext4_es_insert_extent(inode, ee_block, ee_len, ee_pblock,
>  			      EXTENT_STATUS_WRITTEN, false);
> +	/*
> +	 * The zeroed out blocks became written together with the mapped
> +	 * range, but ext4_map_blocks() reports only the mapped range to fast
> +	 * commit.
> +	 */
> +	ext4_fc_track_range(handle, inode, ee_block, ee_block + ee_len - 1);
>  }
>  
>  /* FIXME!! we need to try to merge to left or right after zero-out  */

[ ... ]

> @@ -3400,6 +3407,14 @@ static int ext4_split_extent_zeroout(handle_t *handle, struct inode *inode,
>  	if (err)
>  		return err;
>  
> +	/*
> +	 * The whole extent is written now, not only the range in @map that
> +	 * ext4_map_blocks() reports to fast commit.
> +	 */
> +	if (flags & EXT4_GET_BLOCKS_CONVERT)
> +		ext4_fc_track_range(handle, inode, ee_block,
> +				    ee_block + ee_len - 1);
> +
>  	return 0;
>  }

[Severity: High]
Does this code need to update the in-memory ES tree by calling
ext4_es_insert_extent() before tracking the range for fast commit?

Unlike ext4_zeroout_es(), ext4_split_extent_zeroout() does not update the ES
tree, so the outer zeroed blocks remain EXTENT_STATUS_UNWRITTEN in the cache.

When the fast commit thread runs ext4_fc_snapshot_inode_data(), it traverses
the tracked bounding box and queries the ES tree. Because the ES tree is stale,
it sees the outer blocks as unwritten and incorrectly logs them as
EXT4_FC_TAG_ADD_RANGE with unwritten = 1.

After a crash and replay, could this cause the extent to be incorrectly restored
as unwritten instead of initialized?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261007-ext4-fc-zeroout-v1-0-b86de6439431@samsung.com?part=2

  reply	other threads:[~2026-10-07  0:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-07  0:41 [PATCH 0/2] ext4: fix fast commit and extent status after unwritten extent zero-out Daejun Park
2026-10-07  0:41 ` Daejun Park via B4 Relay
2026-10-07  0:41 ` [PATCH 1/2] ext4: don't cache unzeroed blocks as written after a failed zeroout Daejun Park
2026-10-07  0:41   ` Daejun Park via B4 Relay
2026-10-07  0:50   ` sashiko-bot
2026-10-07 12:51   ` Jan Kara
2026-10-08  6:19   ` Ojaswin Mujoo
2026-10-08  7:47     ` Daejun Park
2026-10-08  9:29       ` (2) " Ojaswin Mujoo
2026-10-07  0:41 ` [PATCH 2/2] ext4: track zeroed out blocks of unwritten extents for fast commit Daejun Park
2026-10-07  0:41   ` Daejun Park via B4 Relay
2026-10-07  0:55   ` sashiko-bot [this message]
2026-10-07  1:09     ` Daejun Park
2026-10-07 13:41   ` Jan Kara
2026-10-08  1:24     ` Daejun Park

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-162556@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=daejun7.park@samsung.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.