On 10/31/22 7:41 AM, Dylan Yudaken wrote: > Requests can be in flight on the io-wq, and can be long lived (for example > a double read will get onto the io-wq). So make sure to retarget the rsrc > nodes on those requests. > > Signed-off-by: Dylan Yudaken <dylany@xxxxxxxx> > --- > io_uring/rsrc.c | 46 ++++++++++++++++++++++++++++++++++++++++++---- > 1 file changed, 42 insertions(+), 4 deletions(-) > > diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c > index 106210e0d5d5..8d0d40713a63 100644 > --- a/io_uring/rsrc.c > +++ b/io_uring/rsrc.c > @@ -16,6 +16,7 @@ > #include "openclose.h" > #include "rsrc.h" > #include "opdef.h" > +#include "tctx.h" > > struct io_rsrc_update { > struct file *file; > @@ -24,6 +25,11 @@ struct io_rsrc_update { > u32 offset; > }; > > +struct io_retarget_data { > + struct io_ring_ctx *ctx; > + unsigned int refs; > +}; Do we really need this struct? As far as I can tell, you pass in ctx only and back refs. It's passed in the callbacks, but they only care about ctx. If io_rsrc_retarget_wq() returned back the refs rather than use data->refs, then we could just pass in the ctx? Or you could at least keep it local to io_rsrc_retarget_wq() and io_retarget_rsrc_wq_cb(). Not a big deal, just always nice to keep the scope of struct as small as can be (or get rid of them). -- Jens Axboe