On Wed, 15 Mar 2006, 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 ?

I don't know.  I'm not familiar with the details of how sysfs is supposed 
to work.  Maybe the existence of the symlink should prevent the dentry 
from being freed during sysfs_remove_dir.  Or maybe sysfs_remove_dir 
should modify the symlink data structure so that the other code would not 
even try to look at dev->kobj->dentry.

(It wouldn't be a bad idea to set dev->kobj->dentry to NULL as soon as the
dentry is deallocated anyway.  Doing that would make bugs a little easier
to spot.)

You know, another possibility is that cdc_acm should call
tty_unregister_device as soon as the USB device is disconnected.  It would
make sense; no point leaving a tty visible in sysfs if it's no longer
accessible (except through already-opened file descriptors). However I
don't know whether the tty subsystem is designed to work that way.

Alan Stern



-------------------------------------------------------
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
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to