On Fri, Apr 14, 2023 at 9:14 PM David Wei <davidhwei@xxxxxxxx> wrote: > > A multishot timeout submission will repeatedly generate completions with > the IORING_CQE_F_MORE cflag set. Depending on the value of the `off' > field in the submission, these timeouts can either repeat indefinitely > until cancelled (`off' = 0) or for a fixed number of times (`off' > 0). > > Only noseq timeouts (i.e. not dependent on the number of I/O > completions) are supported. > > An indefinite timer will be cancelled with EOVERFLOW if the CQ ever > overflows. > > Signed-off-by: David Wei <davidhwei@xxxxxxxx> ... > +static void io_timeout_complete(struct io_kiocb *req, struct io_tw_state *ts) > +{ > + struct io_timeout *timeout = io_kiocb_to_cmd(req, struct io_timeout); > + struct io_timeout_data *data = req->async_data; > + struct io_ring_ctx *ctx = req->ctx; > + > + if (!io_timeout_finish(timeout, data)) { > + bool filled; > + filled = io_aux_cqe(ctx, false, req->cqe.user_data, -ETIME, > + IORING_CQE_F_MORE, false); I think that the defer parameter (the first false) might want to be ts->locked.