OSDN Git Service

io_uring: only force async punt if poll based retry can't handle it
authorJens Axboe <axboe@kernel.dk>
Tue, 28 Apr 2020 19:16:53 +0000 (13:16 -0600)
committerJens Axboe <axboe@kernel.dk>
Fri, 1 May 2020 04:24:27 +0000 (22:24 -0600)
We do blocking retry from our poll handler, if the file supports polled
notifications. Only mark the request as needing an async worker if we
can't poll for it.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c

index 516a59d..b536c34 100644 (file)
@@ -2604,7 +2604,8 @@ copy_iov:
                        if (ret)
                                goto out_free;
                        /* any defer here is final, must blocking retry */
-                       if (!(req->flags & REQ_F_NOWAIT))
+                       if (!(req->flags & REQ_F_NOWAIT) &&
+                           !file_can_poll(req->file))
                                req->flags |= REQ_F_MUST_PUNT;
                        return -EAGAIN;
                }
@@ -2726,7 +2727,8 @@ copy_iov:
                        if (ret)
                                goto out_free;
                        /* any defer here is final, must blocking retry */
-                       req->flags |= REQ_F_MUST_PUNT;
+                       if (!file_can_poll(req->file))
+                               req->flags |= REQ_F_MUST_PUNT;
                        return -EAGAIN;
                }
        }