Re: [PATCHv2 6/6] nvme: Wait for reset state when required

Sagi Grimberg
2019-09-20T20:50:10Z

>>>> static void nvme_reset_done(struct pci_dev *pdev)
>>>> {
>>>> struct nvme_dev *dev = pci_get_drvdata(pdev);
>>>> - nvme_reset_ctrl_sync(&dev->ctrl);
>>>> +
>>>> + if (!nvme_reset_continue(&dev->ctrl))
>>>> + flush_work(&dev->ctrl.reset_work);
>>>
>>> Is nvme_reset_continue allowed to fail here?
>>> As I see it, the flush must complete regardless doesn't it?
>>
>> I was thinking a surprise hot-removal, but no, the pci driver is holding
>> the device lock across the prepare/done sequence, so I don't think it's
>> possible for this reset_continue() to fail to schedule.
>
> Oh wait, there actually is a way, and I even accounted for it in this
> patch, but just forgot about it. If we start an FLR while the controller
> is CONNECTING, and if that CONNECTING fails, we'll transition to DELETING.
> So yeah, reset_continue could fail.

And nvme_remove() will flush the reset_work?