This is a note to let you know that I've just added the patch titled io_uring: clear IOCB_WAITQ for non -EIOCBQUEUED return to the 5.11-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: io_uring-clear-iocb_waitq-for-non-eiocbqueued-return.patch and it can be found in the queue-5.11 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit b79ee7004e598a51a2994375bdafc6ab7fc5c8ea Author: Jens Axboe <axboe@xxxxxxxxx> Date: Thu Mar 4 21:02:58 2021 -0700 io_uring: clear IOCB_WAITQ for non -EIOCBQUEUED return [ Upstream commit b5b0ecb736f1ce1e68eb50613c0cfecff10198eb ] The callback can only be armed, if we get -EIOCBQUEUED returned. It's important that we clear the WAITQ bit for other cases, otherwise we can queue for async retry and filemap will assume that we're armed and return -EAGAIN instead of just blocking for the IO. Cc: stable@xxxxxxxxxxxxxxx # 5.9+ Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/fs/io_uring.c b/fs/io_uring.c index c18e4a334614..262fd4cfd3ad 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -3587,6 +3587,7 @@ static int io_read(struct io_kiocb *req, bool force_nonblock, goto out_free; } else if (ret > 0 && ret < io_size) { /* we got some bytes, but not all. retry. */ + kiocb->ki_flags &= ~IOCB_WAITQ; goto retry; } done: