Merge tag 'printk-for-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/printk...
[platform/kernel/linux-rpi.git] / io_uring / poll.c
index d4597ef..4c360ba 100644 (file)
@@ -300,8 +300,8 @@ static int io_poll_check_events(struct io_kiocb *req, struct io_tw_state *ts)
                        __poll_t mask = mangle_poll(req->cqe.res &
                                                    req->apoll_events);
 
-                       if (!io_aux_cqe(req, ts->locked, mask,
-                                       IORING_CQE_F_MORE, false)) {
+                       if (!io_fill_cqe_req_aux(req, ts->locked, mask,
+                                                IORING_CQE_F_MORE)) {
                                io_req_set_res(req, mask, 0);
                                return IOU_POLL_REMOVE_POLL_USE_RES;
                        }
@@ -824,14 +824,10 @@ static struct io_kiocb *io_poll_file_find(struct io_ring_ctx *ctx,
 
                spin_lock(&hb->lock);
                hlist_for_each_entry(req, &hb->list, hash_node) {
-                       if (!(cd->flags & IORING_ASYNC_CANCEL_ANY) &&
-                           req->file != cd->file)
-                               continue;
-                       if (cd->seq == req->work.cancel_seq)
-                               continue;
-                       req->work.cancel_seq = cd->seq;
-                       *out_bucket = hb;
-                       return req;
+                       if (io_cancel_req_match(req, cd)) {
+                               *out_bucket = hb;
+                               return req;
+                       }
                }
                spin_unlock(&hb->lock);
        }
@@ -855,7 +851,8 @@ static int __io_poll_cancel(struct io_ring_ctx *ctx, struct io_cancel_data *cd,
        struct io_hash_bucket *bucket;
        struct io_kiocb *req;
 
-       if (cd->flags & (IORING_ASYNC_CANCEL_FD|IORING_ASYNC_CANCEL_ANY))
+       if (cd->flags & (IORING_ASYNC_CANCEL_FD | IORING_ASYNC_CANCEL_OP |
+                        IORING_ASYNC_CANCEL_ANY))
                req = io_poll_file_find(ctx, cd, table, &bucket);
        else
                req = io_poll_find(ctx, false, cd, table, &bucket);
@@ -972,8 +969,8 @@ int io_poll_add(struct io_kiocb *req, unsigned int issue_flags)
 int io_poll_remove(struct io_kiocb *req, unsigned int issue_flags)
 {
        struct io_poll_update *poll_update = io_kiocb_to_cmd(req, struct io_poll_update);
-       struct io_cancel_data cd = { .data = poll_update->old_user_data, };
        struct io_ring_ctx *ctx = req->ctx;
+       struct io_cancel_data cd = { .ctx = ctx, .data = poll_update->old_user_data, };
        struct io_hash_bucket *bucket;
        struct io_kiocb *preq;
        int ret2, ret = 0;