[PATCH v3 2/2] nvme: enable generic interface (/dev/ngXnY) for unknown command sets

Keith Busch kbusch at kernel.org
Thu Jun 23 07:57:29 PDT 2022


On Thu, Jun 23, 2022 at 10:39:18AM +0200, Joel Granados wrote:
> On Wed, Jun 22, 2022 at 02:20:05PM -0600, Keith Busch wrote:
> > On Wed, Jun 22, 2022 at 03:55:56PM +0200, Joel Granados wrote:
> > >  static void nvme_validate_or_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
> > >  {
> > >  	struct nvme_ns_ids ids = { };
> > > -	struct nvme_id_ns_cs_indep *id;
> > > +	struct nvme_id_ns_cs_indep *id_indep;
> > >  	struct nvme_ns *ns;
> > > -	bool ready = true;
> > >  
> > >  	if (nvme_identify_ns_descs(ctrl, nsid, &ids))
> > >  		return;
> > >  
> > > +	if (nvme_identify_ns_cs_indep(ctrl, nsid, &id_indep))
> > > +		return;
> > > +
> > 
> > There's no check that the command-set-independent namespace identification is
> > supported, so an error should be expected for many controllers instead of
> > abandoning the namespace.
> good catch. But is the error really necessary?
> If the controller supports NVM or ZNS then we can continue with the
> normal (command-set-dependent) namespace identification.
> 
> I see two situations:
> 
> 1. When we are dealing with NVM or ZNS command sets:
> 1.1 Should bring up a block device regardless of supporting command-set-
>     independent namespace identification
> 1.2 Time-to-ready will be used only if command-set-independent is
>     supported
> 
> 2. When we are dealing with something that is not NVM nor ZNS:
> 2.1 Should bring up a char device iff the command-set-independent
>     namespace identification is supported.
> 2.2 Should abandon the namespace with a dev_warn if the
>     command-set-independent namespace identification is not supported.
> 
> Am I missing something?

I think your description sounds like what we want to happen, but that's not
what the code does. When validating NVM or ZNS namespace, but the controller
doesn't support CNS 8h, the code returns early instead of allocating the
namespace.



More information about the Linux-nvme mailing list