Message ID | 20230714085124.548920-2-hch@lst.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/2] iomap: fix a regression for partial write errors | expand |
On Fri, Jul 14, 2023 at 10:51:24AM +0200, Christoph Hellwig wrote: > We have the new value for ki_pos right at hand in iter.pos, so assign > that instead of recalculating it from ret. > > Signed-off-by: Christoph Hellwig <hch@lst.de> Looks ok, will test... Reviewed-by: Darrick J. Wong <djwong@kernel.org> --D > --- > fs/iomap/buffered-io.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c > index 7cc9f7274883a5..aa8967cca1a31b 100644 > --- a/fs/iomap/buffered-io.c > +++ b/fs/iomap/buffered-io.c > @@ -875,7 +875,7 @@ iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *i, > if (unlikely(iter.pos == iocb->ki_pos)) > return ret; > ret = iter.pos - iocb->ki_pos; > - iocb->ki_pos += ret; > + iocb->ki_pos = iter.pos; > return ret; > } > EXPORT_SYMBOL_GPL(iomap_file_buffered_write); > -- > 2.39.2 >
Christoph Hellwig <hch@lst.de> writes: > We have the new value for ki_pos right at hand in iter.pos, so assign > that instead of recalculating it from ret. > Looks good to me. Feel free to add - Reviewed-by: Ritesh Harjani (IBM) <ritesh.harjani@gmail.com> > Signed-off-by: Christoph Hellwig <hch@lst.de> > --- > fs/iomap/buffered-io.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c > index 7cc9f7274883a5..aa8967cca1a31b 100644 > --- a/fs/iomap/buffered-io.c > +++ b/fs/iomap/buffered-io.c > @@ -875,7 +875,7 @@ iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *i, > if (unlikely(iter.pos == iocb->ki_pos)) > return ret; > ret = iter.pos - iocb->ki_pos; > - iocb->ki_pos += ret; > + iocb->ki_pos = iter.pos; > return ret; > } > EXPORT_SYMBOL_GPL(iomap_file_buffered_write); > -- > 2.39.2
diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 7cc9f7274883a5..aa8967cca1a31b 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -875,7 +875,7 @@ iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *i, if (unlikely(iter.pos == iocb->ki_pos)) return ret; ret = iter.pos - iocb->ki_pos; - iocb->ki_pos += ret; + iocb->ki_pos = iter.pos; return ret; } EXPORT_SYMBOL_GPL(iomap_file_buffered_write);
We have the new value for ki_pos right at hand in iter.pos, so assign that instead of recalculating it from ret. Signed-off-by: Christoph Hellwig <hch@lst.de> --- fs/iomap/buffered-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)