]> exis.tech > repos - linux.git/blobdiff - io_uring/tw.c
Merge tag 'hwmon-for-v7.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/groec...
[linux.git] / io_uring / tw.c
index a4c872870d81c6dddb64063f748a1ae89b1787ef..e6ee15571e85c41c5eb2bc1b4a004305ed0a449c 100644 (file)
@@ -139,11 +139,11 @@ void tctx_task_work(struct callback_head *cb)
  */
 static void io_ctx_mark_taskrun(struct io_ring_ctx *ctx)
 {
+       lockdep_assert_in_rcu_read_lock();
+
        if (ctx->flags & IORING_SETUP_TASKRUN_FLAG) {
-               struct io_rings *rings;
+               struct io_rings *rings = rcu_dereference(ctx->rings_rcu);
 
-               guard(rcu)();
-               rings = rcu_dereference(ctx->rings_rcu);
                atomic_or(IORING_SQ_TASKRUN, &rings->sq_flags);
        }
 }
@@ -153,6 +153,9 @@ void io_req_local_work_add(struct io_kiocb *req, unsigned flags)
        struct io_ring_ctx *ctx = req->ctx;
        int nr_wait;
 
+       /* pairs with synchronize_rcu() in io_ring_exit_work() */
+       guard(rcu)();
+
        /*
         * We don't know how many requests there are in the link and whether
         * they can even be queued lazily, fall back to non-lazy.