Re: [linux-usb-devel] [PATCH] back out sysfs reference count change

From: Alan Stern
Date: Tue Apr 06 2004 - 12:04:55 EST


On Tue, 6 Apr 2004, Maneesh Soni wrote:

> Yes, it came from check_perm(). I think I found the reason for that. The
> attribute group subdirectory's dentry also has a pointer to the same kobject
> as the corresponding directory's dentry. The kobject directory dentry was
> taken care of but the attribute group subdirectory was still pointing to the
> kobject. And that badness message was coming while opening a file under
> attribute subdir.
>
> I am using dentry->d_flags and a new flag value DCACHE_SYSFS_CONNECTED to
> indicate that the dentry is connected to a vaild kobject. I could run my
> stress test of insmod/rmmod for more than 3 hours without any badness message.
>
> I am copying to the maintainers also and hope to get their comments for
> this patch.
>
> Thanks
> Maneesh

I like your patch a lot. It suggests an additional possibility. Maybe
your DCACHE_SYSFS_CONNECTED flag could be used to indicate that an
attribute is registered. That way, after the file is unregistered (even
if the kobject still exists) reads and writes of the attribute would
return an error. This isn't really necessary since opening an attribute
takes a reference to the module owning the attribute, but it is
conceptually attractive.

Alan Stern


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/