On Mon, 2022-10-31 at 10:02 -0600, Jens Axboe wrote: > On 10/31/22 7:41 AM, Dylan Yudaken wrote: > > +static void io_rsrc_retarget_schedule(struct io_ring_ctx *ctx) > > + __must_hold(&ctx->uring_lock) > > +{ > > + percpu_ref_get(&ctx->refs); > > + mod_delayed_work(system_wq, &ctx->rsrc_retarget_work, 60 * > > HZ); > > + ctx->rsrc_retarget_scheduled = true; > > +} > > Can this ever be called with rsrc_retarget_work already pending? If > so, > that would seem to leak a ctx ref. > Not in this patch. In the later patch it can (but only on shutdown) and it checks for it.