linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs: Return EOPNOTSUPP if block layer does not support REQ_NOWAIT
@ 2018-12-13 11:53 Goldwyn Rodrigues
  2018-12-13 12:04 ` Avi Kivity
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: Goldwyn Rodrigues @ 2018-12-13 11:53 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-aio, avi

For AIO+DIO with RWF_NOWAIT, if the block layer does not support REQ_NOWAIT,
it returns EIO. Return EOPNOTSUPP to represent the correct error code.

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
---
 fs/direct-io.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/fs/direct-io.c b/fs/direct-io.c
index 41a0e97252ae..77adf33916b8 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -542,10 +542,13 @@ static blk_status_t dio_bio_complete(struct dio *dio, struct bio *bio)
 	blk_status_t err = bio->bi_status;
 
 	if (err) {
-		if (err == BLK_STS_AGAIN && (bio->bi_opf & REQ_NOWAIT))
-			dio->io_error = -EAGAIN;
-		else
-			dio->io_error = -EIO;
+		dio->io_error = -EIO;
+		if (bio->bi_opf & REQ_NOWAIT) {
+			if (err == BLK_STS_AGAIN)
+				dio->io_error = -EAGAIN;
+			else if (err == BLK_STS_NOTSUPP)
+				dio->io_error = -EOPNOTSUPP;
+		}
 	}
 
 	if (dio->is_async && dio->op == REQ_OP_READ && dio->should_dirty) {
-- 
2.16.4

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

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

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-13 11:53 [PATCH] fs: Return EOPNOTSUPP if block layer does not support REQ_NOWAIT Goldwyn Rodrigues
2018-12-13 12:04 ` Avi Kivity
2018-12-13 14:24   ` Christoph Hellwig
2018-12-13 15:44     ` Goldwyn Rodrigues
2018-12-16 10:45     ` Avi Kivity
2018-12-17 17:38       ` Christoph Hellwig
2018-12-18 11:55         ` Goldwyn Rodrigues
2018-12-20 15:32           ` Avi Kivity
2018-12-13 16:27 ` Matthew Wilcox
2018-12-13 19:04   ` Goldwyn Rodrigues
2018-12-13 22:43 ` Dave Chinner
2018-12-14 17:09   ` Goldwyn Rodrigues
2018-12-16 21:35     ` Dave Chinner
2018-12-18 11:53       ` Goldwyn Rodrigues
2020-07-22 16:08 ` Avi Kivity
2020-07-28 13:38   ` Goldwyn Rodrigues
2020-07-28 13:47     ` Avi Kivity
2020-07-31 13:11   ` Christoph Hellwig

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).