Re: [PATCH v2 4/4] iomap: don't lose a failed direct I/O bio's error when zeroing the tail

From: Pankaj Raghav (Samsung)

Date: Fri Sep 25 2026 - 02:44:17 EST


On Thu, Sep 24, 2026 at 11:11:54AM +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 was assigned
> to ret, which overwrote the submission error with the successful
> zeroing result (zero) and the failed write was reported as success.
>
> iomap_dio_zero() can only return an error from a can't-happen
> WARN_ON_ONCE() (nr_vecs exceeding BIO_MAX_VECS, which the existing
> comment there says "shall never be reached" for any in-tree
> filesystem), so it isn't a real runtime failure worth reporting to
> userspace, let alone one worth losing the actual submission error for.

I initially did not have a return value for this function but later I
had to add it based on comments. But I missed the return value being
overwritten.

> Make iomap_dio_zero() return void and drop the error handling at both
> call sites instead of threading the result through a separate
> variable.
>
> Fixes: 10553a91652d ("iomap: fix iomap_dio_zero() for fs bs > system page size")
> Cc: stable@xxxxxxxxxxxxxxx
> Assisted-by: LLM
> Signed-off-by: Andrea Parri <parri.andrea@xxxxxxxxx>
> ---

Looks good except the comment from Christoph regarding the reformatting.

Reviewed-by: Pankaj Raghav <p.raghav@xxxxxxxxxxx>

--
Pankaj