On Tue, Jun 27, 2023 at 11:21:36AM -0600, Keith Busch wrote: > On Sun, Jun 25, 2023 at 08:26:48AM +0800, Ming Lei wrote: > > Yeah, but you can't remove the gap at all with start_freeze, that said > > the current code has to live with the situation of new mapping change > > and old request with old mapping. > > > > Actually I considered to handle this kind of situation before, one approach > > is to reuse the bio steal logic taken in nvme mpath: > > > > 1) for FS IO, re-submit bios, meantime free request > > > > 2) for PT request, simply fail it > > > > It could be a bit violent for 2) even though REQ_FAILFAST_DRIVER is > > always set for PT request, but not see any better approach for handling > > PT request. > > I think that's acceptable for PT requests, or any request that doesn't > have a bio. I tried something similiar a while back that was almost > working, but I neither never posted it, or it's in that window when > infradead lost all the emails. :( > > Anyway, for the pci controller, I think I see the problem you're fixing. > When reset_work fails, we used to do the mark dead + unquieces via > "nvme_kill_queues()", which doesn't exist anymore, but I think your > scenario worked back then. Currently a failed nvme_reset_work simply > marks them dead without the unquiesce. Would it be enough to just bring > that unqueisce behavior back? > > --- > diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c > index b027e5e3f4acb..8eaa954aa6ed4 100644 > --- a/drivers/nvme/host/pci.c > +++ b/drivers/nvme/host/pci.c > @@ -2778,6 +2778,7 @@ static void nvme_reset_work(struct work_struct *work) > nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_DELETING); > nvme_dev_disable(dev, true); > nvme_mark_namespaces_dead(&dev->ctrl); > + nvme_unquiesce_io_queues(&dev->ctrl); > nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_DEAD); > } That may not be enough: - What if nvme_sysfs_delete() is called from sysfs before the 1st check in nvme_reset_work()? - What if one pending nvme_dev_disable()<-nvme_timeout() comes after the added nvme_unquiesce_io_queues() returns? Thanks, Ming