On Wed, Mar 15, 2006 at 11:00:47AM -0600, Paul Fulghum wrote:
> On Wed, 2006-03-15 at 11:56 -0500, Alan Stern wrote:
> > > Should driver core defer sysfs_remove_file until
> > > last dev->kobj reference is dropped?
> >
> > No. The files should be deleted. James Bottomley refers to this as
> > "removing from visibility". There's no point leaving the symlink visible
> > once it can no longer be used.
> >
> > Instead, the code should be fixed so that the attempt to remove the
> > already-deleted symlink by class_device_del() doesn't cause an oops.
>
> So dev->kobj->dentry should be set to NULL in
> device_remove_file() and other code should be
> fixed to check for dev->kobj->dentry == NULL ?
No, the kobject core should do it for us.
Here's a patch that should fix this up. Bob, can you try it out?
thanks,
greg k-h
---
fs/sysfs/dir.c | 1 +
fs/sysfs/inode.c | 6 +++++-
2 files changed, 6 insertions(+), 1 deletion(-)
--- gregkh-2.6.orig/fs/sysfs/dir.c
+++ gregkh-2.6/fs/sysfs/dir.c
@@ -333,6 +333,7 @@ void sysfs_remove_dir(struct kobject * k
* Drop reference from dget() on entrance.
*/
dput(dentry);
+ kobj->dentry = NULL;
}
int sysfs_rename_dir(struct kobject * kobj, const char *new_name)
--- gregkh-2.6.orig/fs/sysfs/inode.c
+++ gregkh-2.6/fs/sysfs/inode.c
@@ -226,12 +226,16 @@ void sysfs_drop_dentry(struct sysfs_dire
void sysfs_hash_and_remove(struct dentry * dir, const char * name)
{
struct sysfs_dirent * sd;
- struct sysfs_dirent * parent_sd = dir->d_fsdata;
+ struct sysfs_dirent * parent_sd;
+
+ if (!dir)
+ return;
if (dir->d_inode == NULL)
/* no inode means this hasn't been made visible yet */
return;
+ parent_sd = dir->d_fsdata;
mutex_lock(&dir->d_inode->i_mutex);
list_for_each_entry(sd, &parent_sd->s_children, s_sibling) {
if (!sd->s_element)
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel