From: Hao Xu <howeyxu@xxxxxxxxxxx> From: Hao Xu <howeyxu@xxxxxxxxxxx> Add an argument for io_poll_disarm() for later use. Signed-off-by: Hao Xu <howeyxu@xxxxxxxxxxx> --- io_uring/poll.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/io_uring/poll.c b/io_uring/poll.c index 728f6e7b47c5..c8982c5ef0fa 100644 --- a/io_uring/poll.c +++ b/io_uring/poll.c @@ -561,8 +561,9 @@ static struct io_kiocb *io_poll_find(struct io_ring_ctx *ctx, bool poll_only, { struct hlist_head *list; struct io_kiocb *req; + u32 index = hash_long(cd->data, ctx->cancel_hash_bits); - list = &ctx->cancel_hash[hash_long(cd->data, ctx->cancel_hash_bits)]; + list = &ctx->cancel_hash[index]; hlist_for_each_entry(req, list, hash_node) { if (cd->data != req->cqe.user_data) continue; @@ -573,6 +574,7 @@ static struct io_kiocb *io_poll_find(struct io_ring_ctx *ctx, bool poll_only, continue; req->work.cancel_seq = cd->seq; } + cd->flags = index; return req; } return NULL; @@ -602,7 +604,7 @@ static struct io_kiocb *io_poll_file_find(struct io_ring_ctx *ctx, return NULL; } -static bool io_poll_disarm(struct io_kiocb *req) +static bool io_poll_disarm(struct io_kiocb *req, u32 index) __must_hold(&ctx->completion_lock) { if (!io_poll_get_ownership(req)) @@ -724,7 +726,7 @@ int io_poll_remove(struct io_kiocb *req, unsigned int issue_flags) spin_lock(&ctx->completion_lock); preq = io_poll_find(ctx, true, &cd); - if (!preq || !io_poll_disarm(preq)) { + if (!preq || !io_poll_disarm(preq, cd.flags)) { spin_unlock(&ctx->completion_lock); ret = preq ? -EALREADY : -ENOENT; goto out; -- 2.25.1