[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aS5A8SvQ8ww9JkHa@fedora>
Date: Tue, 2 Dec 2025 09:29:21 +0800
From: Ming Lei <ming.lei@...hat.com>
To: Caleb Sander Mateos <csander@...estorage.com>
Cc: Jens Axboe <axboe@...nel.dk>, linux-block@...r.kernel.org,
Uday Shankar <ushankar@...estorage.com>,
Stefani Seibold <stefani@...bold.net>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH V4 15/27] ublk: abort requests filled in event kfifo
On Mon, Dec 01, 2025 at 10:52:22AM -0800, Caleb Sander Mateos wrote:
> On Thu, Nov 20, 2025 at 6:00 PM Ming Lei <ming.lei@...hat.com> wrote:
> >
> > In case of BATCH_IO, any request filled in event kfifo, they don't get
> > chance to be dispatched any more when releasing ublk char device, so
> > we have to abort them too.
> >
> > Add ublk_abort_batch_queue() for aborting this kind of requests.
> >
> > Signed-off-by: Ming Lei <ming.lei@...hat.com>
> > ---
> > drivers/block/ublk_drv.c | 26 +++++++++++++++++++++++++-
> > 1 file changed, 25 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
> > index 2e5e392c939e..849199771f86 100644
> > --- a/drivers/block/ublk_drv.c
> > +++ b/drivers/block/ublk_drv.c
> > @@ -2241,7 +2241,8 @@ static int ublk_ch_mmap(struct file *filp, struct vm_area_struct *vma)
> > static void __ublk_fail_req(struct ublk_device *ub, struct ublk_io *io,
> > struct request *req)
> > {
> > - WARN_ON_ONCE(io->flags & UBLK_IO_FLAG_ACTIVE);
> > + WARN_ON_ONCE(!ublk_dev_support_batch_io(ub) &&
> > + io->flags & UBLK_IO_FLAG_ACTIVE);
> >
> > if (ublk_nosrv_should_reissue_outstanding(ub))
> > blk_mq_requeue_request(req, false);
> > @@ -2251,6 +2252,26 @@ static void __ublk_fail_req(struct ublk_device *ub, struct ublk_io *io,
> > }
> > }
> >
> > +/*
> > + * Request tag may just be filled to event kfifo, not get chance to
> > + * dispatch, abort these requests too
> > + */
> > +static void ublk_abort_batch_queue(struct ublk_device *ub,
> > + struct ublk_queue *ubq)
> > +{
> > + while (true) {
> > + struct request *req;
> > + short tag;
>
> unsigned short?
OK.
>
> > +
> > + if (!kfifo_out(&ubq->evts_fifo, &tag, 1))
> > + break;
> > +
> > + req = blk_mq_tag_to_rq(ub->tag_set.tags[ubq->q_id], tag);
> > + if (req && blk_mq_request_started(req))
>
> If the tag is in the evts_fifo, how would it be possible for the
> request not to have been started yet?
Good point, the above check can be replaced with warn_on_once().
Thanks,
Ming
Powered by blists - more mailing lists