mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Andrea Parri <parri.andrea@gmail.com>
Cc: Christian Brauner <brauner@kernel.org>,
	Joanne Koong <joannelkoong@gmail.com>,
	Brian Foster <bfoster@redhat.com>,
	Damien Le Moal <dlemoal@kernel.org>,
	Hannes Reinecke <hare@suse.de>,
	Daniel Gomez <da.gomez@samsung.com>,
	Pankaj Raghav <p.raghav@samsung.com>,
	Dave Chinner <dchinner@redhat.com>,
	linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH 3/3] iomap: don't lose a failed direct I/O bio's error when zeroing the tail
Date: Mon, 21 Sep 2026 15:34:32 -0700	[thread overview]
Message-ID: <20260921223432.GO6283@frogsfrogsfrogs> (raw)
In-Reply-To: <20260921083133.2960-4-parri.andrea@gmail.com>

On Mon, Sep 21, 2026 at 10:31:33AM +0200, Andrea Parri wrote:
> iomap_dio_bio_iter() falls through to the sub-block tail zeroing when
> the data bio submission fails, so that the rest of the block is still
> zeroed and stale data is not exposed.  The zeroing result is assigned to
> ret, which overwrites the submission error with the successful zeroing
> result (zero) and the failed write is reported as success.
> 
> Store the zeroing result separately and only use it when the data path
> did not already fail.
> 
> Fixes: 10553a91652d9 ("iomap: fix iomap_dio_zero() for fs bs > system page size")
> Cc: stable@vger.kernel.org
> Assisted-by: LLM
> Signed-off-by: Andrea Parri <parri.andrea@gmail.com>
> ---
>  fs/iomap/direct-io.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c
> index 8b4039d16ce89..8ae3fe64e475c 100644
> --- a/fs/iomap/direct-io.c
> +++ b/fs/iomap/direct-io.c
> @@ -581,9 +581,14 @@ static int iomap_dio_bio_iter(struct iomap_iter *iter, struct iomap_dio *dio)
>  	    ((dio->flags & IOMAP_DIO_WRITE) && pos >= i_size_read(inode))) {
>  		/* zero out from the end of the write to the end of the block */
>  		pad = pos & (fs_block_size - 1);
> -		if (pad)
> -			ret = iomap_dio_zero(iter, dio, pos,
> -					     fs_block_size - pad);
> +		if (pad) {
> +			ssize_t zerror;

Why ssize_t?  iomap_dio_zero returns int, right?  I may have missed
something in my absence, but AFAICT it should be:

			int ret2 = iomap_dio_zero(...);

			if (ret2 && !ret)
				ret = ret2;

--D

> +
> +			zerror = iomap_dio_zero(iter, dio, pos,
> +						fs_block_size - pad);
> +			if (!ret)
> +				ret = zerror;
> +		}
>  	}
>  out:
>  	/* Undo iter limitation to current extent */
> -- 
> 2.53.0
> 

  reply	other threads:[~2026-09-21 22:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21  8:31 [PATCH 0/3] iomap: fix error handling regressions Andrea Parri
2026-09-21  8:31 ` [PATCH 1/3] iomap: don't resubmit an ioend after ->writeback_submit() failed Andrea Parri
2026-09-21 22:29   ` Darrick J. Wong
2026-09-22  5:34     ` Christoph Hellwig
2026-09-22  5:33   ` Christoph Hellwig
2026-09-21  8:31 ` [PATCH 2/3] iomap: don't lose a fiemap iteration error when emitting the last extent Andrea Parri
2026-09-21 22:31   ` Darrick J. Wong
2026-09-22  5:34   ` Christoph Hellwig
2026-09-21  8:31 ` [PATCH 3/3] iomap: don't lose a failed direct I/O bio's error when zeroing the tail Andrea Parri
2026-09-21 22:34   ` Darrick J. Wong [this message]
2026-09-22  5:36     ` Christoph Hellwig
2026-09-21 18:07 ` [PATCH 0/3] iomap: fix error handling regressions Brian Foster

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=20260921223432.GO6283@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=bfoster@redhat.com \
    --cc=brauner@kernel.org \
    --cc=da.gomez@samsung.com \
    --cc=dchinner@redhat.com \
    --cc=dlemoal@kernel.org \
    --cc=hare@suse.de \
    --cc=joannelkoong@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=p.raghav@samsung.com \
    --cc=parri.andrea@gmail.com \
    --cc=stable@vger.kernel.org \
    /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®