On 08/04/2021 18:40, Pavel Begunkov wrote: > WARNING: at fs/io_uring.c:8578 io_ring_exit_work.cold+0x0/0x18 > > As reissuing is now passed back by REQ_F_REISSUE, kiocb_done() may just > set the flag and do nothing leaving dangling requests. The handling is a > bit fragile, e.g. can't just complete them because the case of reading > beyond file boundary needs blocking context to return 0, otherwise it > may be -EAGAIN. > > Go the easy way for now, just emulate how it was by io_rw_reissue() in > kiocb_done() Need to adjust the message a bit, will resend > > Fixes: 230d50d448ac ("io_uring: move reissue into regular IO path") > Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx> > Link: https://lore.kernel.org/r/f602250d292f8a84cca9a01d747744d1e797be26.1617842918.git.asml.silence@xxxxxxxxx > Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> > --- > > v2: io_rw_reissue() may fail, check return code > > fs/io_uring.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/fs/io_uring.c b/fs/io_uring.c > index f1881ac0744b..f2df0569a60a 100644 > --- a/fs/io_uring.c > +++ b/fs/io_uring.c > @@ -2762,6 +2762,7 @@ static void kiocb_done(struct kiocb *kiocb, ssize_t ret, > { > struct io_kiocb *req = container_of(kiocb, struct io_kiocb, rw.kiocb); > struct io_async_rw *io = req->async_data; > + bool check_reissue = (kiocb->ki_complete == io_complete_rw); > > /* add previously done IO, if any */ > if (io && io->bytes_done > 0) { > @@ -2777,6 +2778,18 @@ static void kiocb_done(struct kiocb *kiocb, ssize_t ret, > __io_complete_rw(req, ret, 0, issue_flags); > else > io_rw_done(kiocb, ret); > + > + if (check_reissue && req->flags & REQ_F_REISSUE) { > + req->flags &= ~REQ_F_REISSUE; > + if (!io_rw_reissue(req)) { > + int cflags = 0; > + > + req_set_fail_links(req); > + if (req->flags & REQ_F_BUFFER_SELECTED) > + cflags = io_put_rw_kbuf(req); > + __io_req_complete(req, issue_flags, ret, cflags); > + } > + } > } > > static int io_import_fixed(struct io_kiocb *req, int rw, struct iov_iter *iter) > -- Pavel Begunkov