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

Keith Busch
2019-09-20T19:29:11Z

On Fri, Sep 20, 2019 at 12:26:37PM -0600, Keith Busch wrote:
> On Fri, Sep 20, 2019 at 11:13:06AM -0700, Sagi Grimberg wrote:
> > On 9/19/19 2:34 PM, kbusch@kernel.org wrote:
> > > 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.