Skip to content

Commit c0a9d49

Browse files
committed
io_uring/rw: treat -EOPNOTSUPP for IOCB_NOWAIT like -EAGAIN
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: a08d195 ("io_uring/rw: split io_read() into a helper") Signed-off-by: Jens Axboe <[email protected]>
1 parent f011c9c commit c0a9d49

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
@@ -855,6 +855,14 @@ static int __io_read(struct io_kiocb *req, unsigned int issue_flags)
855855

856856
ret = io_iter_do_read(rw, &io->iter);
857857

858+
/*
859+
* Some file systems like to return -EOPNOTSUPP for an IOCB_NOWAIT
860+
* issue, even though they should be returning -EAGAIN. To be safe,
861+
* retry from blocking context for either.
862+
*/
863+
if (ret == -EOPNOTSUPP && force_nonblock)
864+
ret = -EAGAIN;
865+
858866
if (ret == -EAGAIN || (req->flags & REQ_F_REISSUE)) {
859867
req->flags &= ~REQ_F_REISSUE;
860868
/* If we can poll, just do that. */

0 commit comments

Comments
 (0)