linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC] iomap: only return IO error if no data has been transferred
@ 2020-11-17 22:17 Jens Axboe
  2020-11-18  7:09 ` Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Jens Axboe @ 2020-11-17 22:17 UTC (permalink / raw)
  To: Christoph Hellwig, Darrick J. Wong; +Cc: linux-fsdevel

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@kernel.dk>

---

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


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2020-11-26 13:46 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-17 22:17 [PATCH RFC] iomap: only return IO error if no data has been transferred Jens Axboe
2020-11-18  7:09 ` Christoph Hellwig
2020-11-18  7:19 ` Dave Chinner
2020-11-18  7:55   ` Dave Chinner
2020-11-18 15:26   ` Jens Axboe
2020-11-18 20:37     ` Dave Chinner
2020-11-18 21:00       ` Jens Axboe
2020-11-18 21:15         ` Dave Chinner
2020-11-18 21:19           ` Jens Axboe
2020-11-18 21:33             ` Dave Chinner
2020-11-18 21:36               ` Jens Axboe
2020-11-18 21:48                 ` Dave Chinner
2020-11-18 21:55                   ` Jens Axboe
2020-11-18 22:21                     ` Dave Chinner
2020-11-26 14:00 ` [iomap] b258228a4e: Assertion_failed kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).