Commit a30badf6 authored by Jens Axboe's avatar Jens Axboe

io_uring: use cancelation match helper for poll and timeout requests

Get rid of the request vs io_cancel_data checking and just use the
exported helper for this.
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 3a372b66
...@@ -824,14 +824,10 @@ static struct io_kiocb *io_poll_file_find(struct io_ring_ctx *ctx, ...@@ -824,14 +824,10 @@ static struct io_kiocb *io_poll_file_find(struct io_ring_ctx *ctx,
spin_lock(&hb->lock); spin_lock(&hb->lock);
hlist_for_each_entry(req, &hb->list, hash_node) { hlist_for_each_entry(req, &hb->list, hash_node) {
if (!(cd->flags & IORING_ASYNC_CANCEL_ANY) && if (io_cancel_req_match(req, cd)) {
req->file != cd->file) *out_bucket = hb;
continue; return req;
if (cd->seq == req->work.cancel_seq) }
continue;
req->work.cancel_seq = cd->seq;
*out_bucket = hb;
return req;
} }
spin_unlock(&hb->lock); spin_unlock(&hb->lock);
} }
......
...@@ -268,16 +268,10 @@ static struct io_kiocb *io_timeout_extract(struct io_ring_ctx *ctx, ...@@ -268,16 +268,10 @@ static struct io_kiocb *io_timeout_extract(struct io_ring_ctx *ctx,
list_for_each_entry(timeout, &ctx->timeout_list, list) { list_for_each_entry(timeout, &ctx->timeout_list, list) {
struct io_kiocb *tmp = cmd_to_io_kiocb(timeout); struct io_kiocb *tmp = cmd_to_io_kiocb(timeout);
if (!(cd->flags & IORING_ASYNC_CANCEL_ANY) && if (io_cancel_req_match(tmp, cd)) {
cd->data != tmp->cqe.user_data) req = tmp;
continue; break;
if (cd->flags & (IORING_ASYNC_CANCEL_ALL|IORING_ASYNC_CANCEL_ANY)) {
if (cd->seq == tmp->work.cancel_seq)
continue;
tmp->work.cancel_seq = cd->seq;
} }
req = tmp;
break;
} }
if (!req) if (!req)
return ERR_PTR(-ENOENT); return ERR_PTR(-ENOENT);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment