io_uring: break links for failed defer
authorPavel Begunkov <asml.silence@gmail.com>
Tue, 19 Nov 2019 20:32:48 +0000 (23:32 +0300)
committerJens Axboe <axboe@kernel.dk>
Tue, 26 Nov 2019 02:56:06 +0000 (19:56 -0700)
If io_req_defer() failed, it needs to cancel a dependant link.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c

index 6550b7eab7d28ed2c256b3e1520fe7cce36457fc..c1226f609e183aae3522da01b7406ffc0d9db73e 100644 (file)
@@ -2958,6 +2958,8 @@ static void io_queue_sqe(struct io_kiocb *req)
        if (ret) {
                if (ret != -EIOCBQUEUED) {
                        io_cqring_add_event(req, ret);
+                       if (req->flags & REQ_F_LINK)
+                               req->flags |= REQ_F_FAIL_LINK;
                        io_double_put_req(req);
                }
        } else
@@ -2990,6 +2992,8 @@ static void io_queue_link_head(struct io_kiocb *req, struct io_kiocb *shadow)
                if (ret != -EIOCBQUEUED) {
 err:
                        io_cqring_add_event(req, ret);
+                       if (req->flags & REQ_F_LINK)
+                               req->flags |= REQ_F_FAIL_LINK;
                        io_double_put_req(req);
                        if (shadow)
                                __io_free_req(shadow);