io_uring: short circuit -EAGAIN for blocking read attempt

One case was missed in the short IO retry handling, and that's hitting
-EAGAIN on a blocking attempt read (eg from io-wq context). This is a
problem on sockets that are marked as non-blocking when created, they
don't carry any REQ_F_NOWAIT information to help us terminate them
instead of perpetually retrying.

Fixes: 227c0c9673d8 ("io_uring: internally retry short reads")
Signed-off-by: Jens Axboe <axboe@kernel.dk>

Changed files
+4 -1
fs
+4 -1
fs/io_uring.c
··· 3186 3186 ret = 0; 3187 3187 goto out_free; 3188 3188 } else if (ret == -EAGAIN) { 3189 + if (!force_nonblock) 3190 + goto done; 3189 3191 ret = io_setup_async_rw(req, iovec, inline_vecs, iter, false); 3190 3192 if (ret) 3191 3193 goto out_free; ··· 3197 3195 } 3198 3196 3199 3197 /* read it all, or we did blocking attempt. no retry. */ 3200 - if (!iov_iter_count(iter) || !force_nonblock) 3198 + if (!iov_iter_count(iter) || !force_nonblock || 3199 + (req->file->f_flags & O_NONBLOCK)) 3201 3200 goto done; 3202 3201 3203 3202 io_size -= ret;