From mboxrd@z Thu Jan 1 00:00:00 1970 From: kbusch@kernel.org (Keith Busch) Date: Wed, 14 Aug 2019 10:06:41 -0600 Subject: [PATCH] nvme: Use first ctrl->instance id as subsystem id In-Reply-To: <20190814142836.2322-1-gpiccoli@canonical.com> References: <20190814142836.2322-1-gpiccoli@canonical.com> Message-ID: <20190814160640.GA3256@localhost.localdomain> On Wed, Aug 14, 2019@07:28:36AM -0700, Guilherme G. Piccoli wrote: > Since after the introduction of NVMe multipath, we have a struct to > track subsystems, and more important, we have now the nvme block device > name bound to the subsystem id instead of ctrl->instance as before. > This is not a big problem, users can even fallback to the old behavior > using the module parameter "nvme_core.multipath=N" in case they don't > have multipath and wish to have a consistent mapping between the char > device nvmeX and the block device nvmeXnY. > > That said, we noticed the nvme subsystem id is generated by its own ID > allocator, and ctrl->instance value has itself an ID allocator too. > The controller instance is generated during the probe, in the function > nvme_init_ctrl(), which always executes before nvme_init_subsystem(). > That said, and since according to the spec we have a relation 1:N > between subsystem and controllers (i.e., one subsystem may have more > controllers but not the reciprocal), why not use the ctrl->instance id > as the subsystem id? The subsystem lifetime is not tied to a single controller's. Disconnect the "first" controller in a multipathed subsystem with this patch, then connect another controller from a different subsystem, and now you will create naming collisions.