Andrew, here's the real problem for the USB problem you wrote me about today, and I duplicated. It seems Maneesh's sysfs patch is still not stable, and should be backed out.
Here's the report from Alan Stern about what the problem is. I have more commentary and a workaround patch for USB following his comments below: On Sat, Mar 27, 2004 at 11:10:33PM -0500, Alan Stern wrote: > 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? Yes, I agree there is a problem and can easily duplicate it, as can Andrew and others. The simple patch that you sent me (and I've included below does paper over the problem, but as you have just shown, this is not the real problem. The real problem is the sysfs patch that went in. Andrew, here's the USB patch from Alan that will fix the issue right now, but it's the incorrect fix, as we can cause oopses with it. Because of this, I'll send a patch next that backs Maneesh's patch out, to solve the problem for now. thanks, greg k-h --- 1.73/drivers/usb/core/message.c Wed Mar 17 14:16:47 2004 +++ edited/drivers/usb/core/message.c Wed Mar 24 10:17:04 2004 @@ -794,9 +794,6 @@ static void release_interface(struct device *dev) { - struct usb_interface *interface = to_usb_interface(dev); - - complete(interface->released); } /* @@ -828,16 +825,12 @@ if (dev->actconfig) { for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) { struct usb_interface *interface; - struct completion intf_completion; /* remove this interface */ interface = dev->actconfig->interface[i]; dev_dbg (&dev->dev, "unregistering interface %s\n", interface->dev.bus_id); - init_completion (&intf_completion); - interface->released = &intf_completion; device_unregister (&interface->dev); - wait_for_completion (&intf_completion); } dev->actconfig = 0; if (dev->state == USB_STATE_CONFIGURED) ------------------------------------------------------- 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
