]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
io_uring: add missing io_req_cancelled()
authorPavel Begunkov <asml.silence@gmail.com>
Sat, 15 Feb 2020 22:01:18 +0000 (01:01 +0300)
committerJens Axboe <axboe@kernel.dk>
Sun, 16 Feb 2020 17:09:37 +0000 (10:09 -0700)
fallocate_finish() is missing cancellation check. Add it.
It's safe to do that, as only flags setup and sqe fields copy are done
before it gets into __io_fallocate().

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

index 5a826017ebb84e3701a3e0626441971a18cc778d..29565d82291f06be268b00bbb9327a8339c42b3f 100644 (file)
@@ -2517,6 +2517,9 @@ static void io_fallocate_finish(struct io_wq_work **workptr)
        struct io_kiocb *nxt = NULL;
        int ret;
 
+       if (io_req_cancelled(req))
+               return;
+
        ret = vfs_fallocate(req->file, req->sync.mode, req->sync.off,
                                req->sync.len);
        if (ret < 0)
@@ -2904,6 +2907,7 @@ static void io_close_finish(struct io_wq_work **workptr)
        struct io_kiocb *req = container_of(*workptr, struct io_kiocb, work);
        struct io_kiocb *nxt = NULL;
 
+       /* not cancellable, don't do io_req_cancelled() */
        __io_close_finish(req, &nxt);
        if (nxt)
                io_wq_assign_next(workptr, nxt);