[PATCHv2] nvme-pci: fix timeout request state check

Christoph Hellwig hch at lst.de
Tue Jan 17 23:33:30 PST 2023


On Tue, Jan 17, 2023 at 10:52:39PM -0700, Keith Busch wrote:
> We're actually not batching here (no IOB in the timeout context), so we
> are either:
> 
>   a. calling nvme_pci_complete_rq() inline with the cqe
>   b. racing with smp ipi or softirq
> 
> If case (a), we will always see IDLE. If (b), we are racing and may see
> either COMPLETED or IDLE, so we have to check that it's not either of
> those. Since there's only one other state (STARTED) that was guaranteed
> prior to entering the timeout handler, we can just make sure it's not
> that one after the poll to know if abort escalation is needed.

The point is still that "started" is the wrong check here and relies
on an implementation detail.  I think we're better off with an explicit
IDLE check and a big fat comment.



More information about the Linux-nvme mailing list