Am Montag, 27. November 2006 21:43 schrieb Alan Stern: > 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.
Shit. > In sysfs_remove_file(), kobj->dentry is the dentry for the device, not for Therefore I got no ENODEV! > 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. _before_? IMHO the core of the problem is that you may have open fds for which there is no dentry. The existing code drops the dentry, thus preventing further open() calls, but the open files must be dissociated from the buffers to free the buffers. Therefore the correct position is _after_ the drop. > 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). IMHO by a previous dropping all dentries, you make sure the usage count of an inode will monotonically decrease. > 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. OK. Regards Oliver ------------------------------------------------------------------------- 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