Skip to content

Commit 57cd041

Browse files
axboegregkh
authored andcommitted
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 <[email protected]> Link: https://fosstodon.org/@[email protected]/113112431889638440 Cc: [email protected] Fixes: a08d195b586a ("io_uring/rw: split io_read() into a helper") Signed-off-by: Jens Axboe <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 7206043 commit 57cd041

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

io_uring/rw.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,14 @@ static int __io_read(struct io_kiocb *req, unsigned int issue_flags)
757757

758758
ret = io_iter_do_read(rw, &s->iter);
759759

760+
/*
761+
* Some file systems like to return -EOPNOTSUPP for an IOCB_NOWAIT
762+
* issue, even though they should be returning -EAGAIN. To be safe,
763+
* retry from blocking context for either.
764+
*/
765+
if (ret == -EOPNOTSUPP && force_nonblock)
766+
ret = -EAGAIN;
767+
760768
if (ret == -EAGAIN || (req->flags & REQ_F_REISSUE)) {
761769
req->flags &= ~REQ_F_REISSUE;
762770
/* if we can poll, just do that */

0 commit comments

Comments
 (0)