Commit 20c64ec8 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Darrick J. Wong

iomap: fix a regression for partial write errors

When write* wrote some data it should return the amount of written data
and not the error code that caused it to stop.  Fix a recent regression
in iomap_file_buffered_write that caused it to return the errno instead.

Fixes: 219580ee ("iomap: update ki_pos in iomap_file_buffered_write")
Reported-by: default avatarkernel test robot <oliver.sang@intel.com>
Reported-by: default avatarCyril Hrubis <chrubis@suse.cz>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarRitesh Harjani (IBM) <ritesh.harjani@gmail.com>
parent fdf0eaf1
......@@ -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 (unlikely(iter.pos == iocb->ki_pos))
return ret;
ret = iter.pos - iocb->ki_pos;
iocb->ki_pos += ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment