[PATCH RFC] iomap: only return IO error if no data has been transferred

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If we've successfully transferred some data in __iomap_dio_rw(),
don't mark an error for a latter segment in the dio.

Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>

---

Debugging an issue with io_uring, which uses IOCB_NOWAIT for the
IO. If we do parts of an IO, then once that completes, we still
return -EAGAIN if we ran into a problem later on. That seems wrong,
normal convention would be to return the short IO instead. For the
-EAGAIN case, io_uring will retry later parts without IOCB_NOWAIT
and complete it successfully.

diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c
index 933f234d5bec..1aa462bf9266 100644
--- a/fs/iomap/direct-io.c
+++ b/fs/iomap/direct-io.c
@@ -538,7 +538,11 @@ __iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter,
 	} while ((count = iov_iter_count(iter)) > 0);
 	blk_finish_plug(&plug);
 
-	if (ret < 0)
+	/*
+	 * Only flag an error if we're still at the start of the operation.
+	 * If we've already done some IO, return a short result instead.
+	 */
+	if (ret < 0 && iocb->ki_pos == pos)
 		iomap_dio_set_error(dio, ret);
 
 	/*

-- 
Jens Axboe




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux