On Mon, 27 Nov 2006, Oliver Neukum wrote:

> Am Montag, 27. November 2006 20:45 schrieb Alan Stern:
> > I like it, except for one little detail.  You don't need buffer->anchor; 
> > it gets used only in remove_from_collection(), which is called only from 
> > sysfs_release(), so you can pass the inode directly as an argument.
> 
> Right.

Uh-oh.  I just realized there is a problem.

In sysfs_remove_file(), kobj->dentry is the dentry for the device, not for
the attribute.  The place where you need to call orphan_all_buffers() is
in inode.c:sysfs_drop_dentry().  I'm not sure exactly where in that
routine is the correct spot to do it.  Possibly just before the call to
simple_unlink(), but I don't know enough about how the filesystem code
works.

Logically there must be a race between sysfs_remove_file() and 
deallocating the inode (when there are no open file references).  I 
don't know how this race is resolved; maybe in __d_drop(dentry).

Alan Stern

P.S.: In sysfs_release(), you don't have to compute
filp->f_dentry->d_inode.  There already is a local variable pointing
directly to the inode.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
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