[PATCH] nvme/pci: fix queue_rqs list splitting

Jens Axboe axboe at kernel.dk
Wed Dec 22 16:04:04 PST 2021


On 12/22/21 2:41 PM, Keith Busch wrote:
> If command prep fails, current handling will orphan subsequent requests
> in the list. Consider a simple example:
> 
>   rqlist = [ 1 -> 2 ]
> 
> When prep for request '1' fails, it will be appended to the
> 'requeue_list', leaving request '2' disconnected from the original
> rqlist and no longer tracked. Meanwhile, rqlist is still pointing to the
> failed 'req' and will attempt to submit the unprepped command.
> 
> Fix this by updating the rqlist accordingly.

Good catch.

> Just IMO, the rq list manipulation looks a bit fragile for the lld. If
> more drivers want to subscribe to the new .queue_rqs() interface, I have
> another patch set ready for consideration with helper macros to make
> this sort of error handling a little easier for re-use.

I'd love to make it so that the driver didn't need the list manipulation,
but I also don't want to turn it into Yet Another indirect call. We could
potentially do the same trick as was done for:

commit c234a65392062504acf04afe0ae404cca61a8e1a
Author: Jens Axboe <axboe at kernel.dk>
Date:   Fri Oct 8 05:59:37 2021 -0600

    nvme: add support for batched completion of polled IO

where the function pointer is known and gcc turns it into a direct
call instead?

-- 
Jens Axboe




More information about the Linux-nvme mailing list