Patch "io_uring: fix hanging iopoll in case of -EAGAIN" has been added to the 5.7-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    io_uring: fix hanging iopoll in case of -EAGAIN

to the 5.7-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-fix-hanging-iopoll-in-case-of-eagain.patch
and it can be found in the queue-5.7 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 7544a902aad6b1b080bd1bbce66093ca588218fc
Author: Pavel Begunkov <asml.silence@xxxxxxxxx>
Date:   Thu Jun 25 12:37:10 2020 +0300

    io_uring: fix hanging iopoll in case of -EAGAIN
    
    [ Upstream commit cd664b0e35cb1202f40c259a1a5ea791d18c879d ]
    
    io_do_iopoll() won't do anything with a request unless
    req->iopoll_completed is set. So io_complete_rw_iopoll() has to set
    it, otherwise io_do_iopoll() will poll a file again and again even
    though the request of interest was completed long time ago.
    
    Also, remove -EAGAIN check from io_issue_sqe() as it races with
    the changed lines. The request will take the long way and be
    resubmitted from io_iopoll*().
    
    io_kiocb's result and iopoll_completed")
    
    Fixes: bbde017a32b3 ("io_uring: add memory barrier to synchronize
    Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx>
    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 1829be7f63a35..4ab1728de247c 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -1942,10 +1942,8 @@ static void io_complete_rw_iopoll(struct kiocb *kiocb, long res, long res2)
 
 	WRITE_ONCE(req->result, res);
 	/* order with io_poll_complete() checking ->result */
-	if (res != -EAGAIN) {
-		smp_wmb();
-		WRITE_ONCE(req->iopoll_completed, 1);
-	}
+	smp_wmb();
+	WRITE_ONCE(req->iopoll_completed, 1);
 }
 
 /*
@@ -5425,9 +5423,6 @@ static int io_issue_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe,
 	if ((ctx->flags & IORING_SETUP_IOPOLL) && req->file) {
 		const bool in_async = io_wq_current_is_worker();
 
-		if (req->result == -EAGAIN)
-			return -EAGAIN;
-
 		/* workqueue context doesn't hold uring_lock, grab it now */
 		if (in_async)
 			mutex_lock(&ctx->uring_lock);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux