[PATCH 13/13] nvme: introduce generic per-namespace chardev

Keith Busch kbusch at kernel.org
Fri Apr 9 15:29:27 BST 2021


On Fri, Apr 09, 2021 at 08:14:32AM +0200, Christoph Hellwig wrote:
> On Fri, Apr 09, 2021 at 01:56:13AM +0900, Keith Busch wrote:
> > On Thu, Apr 08, 2021 at 02:08:42PM +0200, Christoph Hellwig wrote:
> > > +int nvme_cdev_add(struct cdev *cdev, struct device *cdev_device,
> > > +		const struct file_operations *fops, struct module *owner)
> > > +{
> > > +	int minor, ret;
> > > +
> > > +	minor = ida_simple_get(&nvme_ns_chr_minor_ida, 0, 0, GFP_KERNEL);
> > 
> > Do we really need to allocate a minor specific for this char dev? It
> > looks like the ns->head->instance can provide the unique value.
> 
> Looking at this:  no, head->instance doesn't help as it is an
> instance relative to subsystem, but doesn't help with a global
> allocation over all subsystems.

Right, my mistake.

In that case, there needs to be a ida_simple_remove() after the
cdev_device_del() so we don't leak the ida.



More information about the Linux-nvme mailing list