Re: [PATCH v2] driver/nvme/host: Support duplicated nsid for the private ns

hch
2022-03-15T08:40:43Z

On Tue, Mar 15, 2022 at 10:18:30AM +0200, Sagi Grimberg wrote:
>> +static struct nvme_ns_head *nvme_find_ns_head(struct nvme_ctrl *ctrl,
>> unsigned nsid)
>> {
>> + struct nvme_subsystem *subsys = ctrl->subsys;
>> struct nvme_ns_head *h;
>> lockdep_assert_held(&subsys->lock);
>
> IMO it is a bit strange that we now don't pass in the subsystem but
> require that the subsys->lock is taken...

We do things like that in various places, mostly because information
needed that is subsystem-wide hangs of the nvme_ctrl structure, in
this case the various feature bitmaps. We could move them to the
subsystem structure, which would be the right thing to do but a fair
amout of churn for little savings.

>> +++ b/drivers/nvme/host/multipath.c
>> @@ -504,10 +504,11 @@ int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl, struct nvme_ns_head *head)
>> /*
>> * Add a multipath node if the subsystems supports multiple controllers.
>> - * We also do this for private namespaces as the namespace sharing data could
>> - * change after a rescan.
>> + * We also do this for private namespaces as the namespace sharing flag
>> + * could change after a rescan.
>
> What happens in this case? we now have non-unique shared namespaces?

The non-uniqueue NSIDs can only happen for private namespaces.