diff options
| author | Jens Axboe <axboe@kernel.dk> | 2024-09-10 08:30:57 -0600 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-10-04 16:33:22 +0200 |
| commit | daf062a2d7ed875163102d6d5d54564abe4ae282 (patch) | |
| tree | a5130f042b16a5b9e1b2515df70c3d7197d3c6af /io_uring | |
| parent | a1dbcdfc232044e9f5e3a06ac1bc01709f027648 (diff) | |
| download | linux-daf062a2d7ed875163102d6d5d54564abe4ae282.tar.gz linux-daf062a2d7ed875163102d6d5d54564abe4ae282.tar.bz2 linux-daf062a2d7ed875163102d6d5d54564abe4ae282.zip | |
io_uring/rw: treat -EOPNOTSUPP for IOCB_NOWAIT like -EAGAIN
commit c0a9d496e0fece67db777bd48550376cf2960c47 upstream.
Some file systems, ocfs2 in this case, will return -EOPNOTSUPP for
an IOCB_NOWAIT read/write attempt. While this can be argued to be
correct, the usual return value for something that requires blocking
issue is -EAGAIN.
A refactoring io_uring commit dropped calling kiocb_done() for
negative return values, which is otherwise where we already do that
transformation. To ensure we catch it in both spots, check it in
__io_read() itself as well.
Reported-by: Robert Sander <r.sander@heinlein-support.de>
Link: https://fosstodon.org/@gurubert@mastodon.gurubert.de/113112431889638440
Cc: stable@vger.kernel.org
Fixes: a08d195b586a ("io_uring/rw: split io_read() into a helper")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'io_uring')
| -rw-r--r-- | io_uring/rw.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/io_uring/rw.c b/io_uring/rw.c index 1a2128459cb4..e6b44367df67 100644 --- a/io_uring/rw.c +++ b/io_uring/rw.c @@ -856,6 +856,14 @@ static int __io_read(struct io_kiocb *req, unsigned int issue_flags) ret = io_iter_do_read(rw, &io->iter); + /* + * Some file systems like to return -EOPNOTSUPP for an IOCB_NOWAIT + * issue, even though they should be returning -EAGAIN. To be safe, + * retry from blocking context for either. + */ + if (ret == -EOPNOTSUPP && force_nonblock) + ret = -EAGAIN; + if (ret == -EAGAIN || (req->flags & REQ_F_REISSUE)) { req->flags &= ~REQ_F_REISSUE; /* If we can poll, just do that. */ |
