[PATCH 4/5] io_uring: add missing io_req_cancelled()

From: Pavel Begunkov
Date: Tue Feb 11 2020 - 15:03:08 EST


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@xxxxxxxxx>
---
fs/io_uring.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index f3108bce4afe..b33f2521040e 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2529,6 +2529,8 @@ static void io_fallocate_finish(struct io_wq_work **workptr)
struct io_kiocb *req = container_of(*workptr, struct io_kiocb, work);
struct io_kiocb *nxt = NULL;

+ if (io_req_cancelled(req))
+ return;
__io_fallocate(req, &nxt);
if (nxt)
io_wq_assign_next(workptr, nxt);
@@ -2905,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 io_req_cancelled() */
__io_close_finish(req, &nxt);
if (nxt)
io_wq_assign_next(workptr, nxt);
--
2.24.0