Messages in this thread | | | Date | Wed, 4 Sep 2019 08:44:27 -0600 | From | Keith Busch <> | Subject | Re: [PATCH] nvme-core: Fix subsystem instance mismatches |
| |
On Wed, Sep 04, 2019 at 08:05:58AM +0200, Christoph Hellwig wrote: > On Tue, Sep 03, 2019 at 10:46:20AM -0600, Keith Busch wrote: > > Could we possibly make /dev/nvmeX be a subsystem handle without causing > > trouble for anyone? This would essentially be the same thing as today > > for non-CMIC controllers with a device-per-controller and only affects > > the CMIC ones. > > A per-subsyste character device doesn't make sense, as a lot of admin > command require a specific controller.
Yeah, I was hoping to provide something special for CMIC controllers so you can do path specific admin, but that looks sure to break user space.
> If this really is an isue for people we'll just need to refcount the > handle allocation. That is: > > - nvme_init_ctrl allocates a new nvme_instance or so object, which > does the ida_simple_get. > - we allocate a new subsystem that reuses the handle and grabs > a reference in nvme_init_subsystem, then if we find an existing > subsystem we drop that reference again. > - last free of a ctrl or subsystem also drops a reference, with > the final free releasing the ida
Let me step through an example:
Ctrl A gets instance 0.
Its subsystem gets the same instance, and takes ref count on it: all namespaces in this subsystem will use '0'.
Ctrl B gets instance 1, and it's in the same subsystem as Ctrl A so no new subsytem is allocated.
Ctrl A is disconnected, dropping its ref on instance 0, but the subsystem still has its refcount, making it unavailable.
Ctrl A is reconnected, and allocates instance 2 because 0 is still in use.
Now all the namespaces in this subsystem are prefixed with nvme0, but no controller exists with the same prefix. We still have inevitable naming mismatch, right?
| |