I tracked down the source of the problem (khubd blocked) affecting a
number of users recently -- at least, I think it's the source.  It's a
change that was made to sysfs by Maneesh Soni about 10 days ago.  It
triggered a bad interaction (or perhaps exposed a pre-existing flaw) in
the dcache code.  The changeset is:

http://linux.bkbits.net:8080/linux-2.5/[EMAIL 
PROTECTED]|src/|src/fs|src/fs/sysfs|related/fs/sysfs/dir.c

I wrote to him about it on LKML (sorry I forgot to CC you, Alexander):

http://marc.theaimsgroup.com/?l=linux-kernel&m=108042663516325&w=2

The change causes sysfs to take a reference to a kobject when it is 
add()'ed and its directory is created.  The reference is dropped when the 
dentry for the directory is removed.

The problem shows up when a nonexistent symlink or file is deleted from a 
sysfs directory.  The code does a name lookup, and since the name doesn't 
match an existing file a new dentry is created for it, increasing the 
directory's refcount by 1.  That new dentry is released at the end of the 
unlink routine, but the release fails to decrement the directory's 
refcount.  The dentry winds up on a LRU list and is still pointed at by 
the parent -- I don't know whether that's supposed to happen or not.

The upshot is that the directory has this persistent dentry for a
nonexistent file, so it doesn't get released, so it doesn't drop its
reference to its kobject, so the kobject doesn't get released.

I observed this behavior in the SCSI system.  When a SCSI device is added, 
a class_device directory is created for it under /sys/class/scsi_devices.  
The directory contains a "device" symlink but not a "driver" symlink.  
When the SCSI device is hot-unplugged, the class_device routines try to 
delete both symlinks and that triggers the problem.

Alan Stern

P.S.: I haven't gotten many comments regarding the questions raised at the 
start of this thread.  Greg, have you had a chance to think through the 
alternatives?



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to