On Thu, Aug 05, 2021 at 12:00:11AM -0700, [email protected] wrote:
> +static int az_blob_create_device(struct az_blob_device *dev)
> +{
> + int ret;
> + struct dentry *debugfs_root;
> +
> + dev->misc.minor = MISC_DYNAMIC_MINOR,
> + dev->misc.name = "azure_blob",
> + dev->misc.fops = &az_blob_client_fops,
> +
> + ret = misc_register(&dev->misc);
> + if (ret)
> + return ret;
> +
> + debugfs_root = debugfs_create_dir("az_blob", NULL);
So you try to create a directory in the root of debugfs called "az_blob"
for every device in the system of this one type?
That will blow up when you have multiple devices of the same type,
please fix.
thanks,
greg k-h
> Subject: Re: [Patch v5 2/3] Drivers: hv: add Azure Blob driver
>
> On Thu, Aug 05, 2021 at 12:00:11AM -0700, [email protected] wrote:
> > +static int az_blob_create_device(struct az_blob_device *dev) {
> > + int ret;
> > + struct dentry *debugfs_root;
> > +
> > + dev->misc.minor = MISC_DYNAMIC_MINOR,
> > + dev->misc.name = "azure_blob",
> > + dev->misc.fops = &az_blob_client_fops,
> > +
> > + ret = misc_register(&dev->misc);
> > + if (ret)
> > + return ret;
> > +
> > + debugfs_root = debugfs_create_dir("az_blob", NULL);
>
> So you try to create a directory in the root of debugfs called "az_blob"
> for every device in the system of this one type?
>
> That will blow up when you have multiple devices of the same type, please
> fix.
The Hyper-V presents one such device for the whole VM.
I'm sorry I may have misunderstood. Are you suggesting I should create a directory "hyperv" in the root of debugfs and put all the Hyper-V driver debug information there?
>
> thanks,
>
> greg k-h
On Thu, Aug 05, 2021 at 06:07:31PM +0000, Long Li wrote:
> > Subject: Re: [Patch v5 2/3] Drivers: hv: add Azure Blob driver
> >
> > On Thu, Aug 05, 2021 at 12:00:11AM -0700, [email protected] wrote:
> > > +static int az_blob_create_device(struct az_blob_device *dev) {
> > > + int ret;
> > > + struct dentry *debugfs_root;
> > > +
> > > + dev->misc.minor = MISC_DYNAMIC_MINOR,
> > > + dev->misc.name = "azure_blob",
> > > + dev->misc.fops = &az_blob_client_fops,
> > > +
> > > + ret = misc_register(&dev->misc);
> > > + if (ret)
> > > + return ret;
> > > +
> > > + debugfs_root = debugfs_create_dir("az_blob", NULL);
> >
> > So you try to create a directory in the root of debugfs called "az_blob"
> > for every device in the system of this one type?
> >
> > That will blow up when you have multiple devices of the same type, please
> > fix.
>
> The Hyper-V presents one such device for the whole VM.
Today, maybe, tomorrow, who knows. Do not write code that we know will
be wrong if you have multiple devices in the system of the same type.
It takes almost no effort to get this correct.
> I'm sorry I may have misunderstood. Are you suggesting I should create
> a directory "hyperv" in the root of debugfs and put all the Hyper-V
> driver debug information there?
Ideally, yes, if the hyperv subsystem uses debugfs, it should make a
subdir and you should use that. If not, then do whatever you want, but
do not do something that you know will be broken if you have multiple
devices of the same type in the system, like the current code is
showing.
thanks,
greg k-h