mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zhang Yi <yizhang089@gmail.com>
To: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
	Theodore Ts'o <tytso@mit.edu>,
	Andreas Dilger <adilger.kernel@dilger.ca>,
	Baokun Li <libaokun@linux.alibaba.com>, Jan Kara <jack@suse.cz>,
	"Ritesh Harjani (IBM)" <ritesh.list@gmail.com>,
	Zhang Yi <yi.zhang@huawei.com>
Subject: Re: [PATCH] ext4: return -EINVAL on hole in ext4_convert_unwritten_extents_atomic()
Date: Sat, 24 Oct 2026 09:52:40 +0800	[thread overview]
Message-ID: <02b542c0-8b25-41b3-b271-fb6fde641544@gmail.com> (raw)
In-Reply-To: <20261023-ext4-atomic-endio-fix-b4-v1-1-f91feb0b9613@linux.ibm.com>

On 10/23/2026 6:23 PM, Ojaswin Mujoo wrote:
> We should ideally never encounter a hole during the endio conversion as
> that indicates something is wrong with our extent handling. Still if we do
> find a hole at atomic write endio, ext4_map_blocks() returns 0 which would
> be returned back to callers by ext4_convert_unwritten_extents_atomic().
> This can be wrongly interpreted as a success. Fix this by bailing out with
> -EINVAL instead.
> 
> Signed-off-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>

Ha, this looks good to me, thanks!

Reviewed-by: Zhang Yi <yi.zhang@huawei.com>

> ---
>   fs/ext4/extents.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 
> diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> index 7193429a05e1..b54d8227786b 100644
> --- a/fs/ext4/extents.c
> +++ b/fs/ext4/extents.c
> @@ -5107,6 +5107,14 @@ int ext4_convert_unwritten_extents_atomic(handle_t *handle, struct inode *inode,
>   		map.m_lblk += ret;
>   		map.m_len = (max_blocks -= ret);
>   		ret = ext4_map_blocks(handle, inode, &map, flags);
> +		if (ret == 0) {
> +			ext4_msg(inode->i_sb, KERN_ERR,
> +				 "inode #%llu: block %u: len %u: "
> +				 "hole found while converting extents for atomic write",
> +				 inode->i_ino, map.m_lblk, map.m_len);
> +			ret = -EINVAL;
> +			break;
> +		}
>   		if (ret != max_blocks)
>   			ext4_msg(inode->i_sb, KERN_INFO,
>   				     "inode #%llu: block %u: len %u: "
> 
> ---
> base-commit: 8c4f6e3376348fc3162eed86a05b933921c8f9ed
> change-id: 20261023-ext4-atomic-endio-fix-b4-9e1ead9e1aca
> 
> Best regards,


      parent reply	other threads:[~2026-10-24  1:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-23 10:23 Ojaswin Mujoo
2026-10-23 11:56 ` Jan Kara
2026-10-24  1:52 ` Zhang Yi [this message]

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=02b542c0-8b25-41b3-b271-fb6fde641544@gmail.com \
    --to=yizhang089@gmail.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=jack@suse.cz \
    --cc=libaokun@linux.alibaba.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ojaswin@linux.ibm.com \
    --cc=ritesh.list@gmail.com \
    --cc=tytso@mit.edu \
    --cc=yi.zhang@huawei.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

all inboxes | Powered by JetHome®