On Thu, Jul 13, 2023 at 05:34:55PM +0200, Cyril Hrubis wrote: > iter.processed = iomap_write_iter(&iter, i); > > + iocb->ki_pos += iter.pos - iocb->ki_pos; > + > if (unlikely(ret < 0)) > return ret; > - ret = iter.pos - iocb->ki_pos; > - iocb->ki_pos += ret; > - return ret; > + > + return iter.pos - iocb->ki_pos; I don't think this works, as iocb->ki_pos has been updated above. What you want is probably the version below. But so far I can't reproduce anything yet.. diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index adb92cdb24b009..02aea0174ddbcf 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -872,7 +872,7 @@ iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *i, while ((ret = iomap_iter(&iter, ops)) > 0) iter.processed = iomap_write_iter(&iter, i); - if (unlikely(ret < 0)) + if (iter.pos == iocb->ki_pos) return ret; ret = iter.pos - iocb->ki_pos; iocb->ki_pos += ret;