On Sat, 18 Sep 2004, Nix N. Nix wrote: > On Sat, 2004-09-18 at 21:18, Alan Stern wrote: > > The "known bug" is that when an HCD module is rmmod'ed it doesn't wait for > > all the USB device refcounts to go to 0 -- but when they do a routine in > > the HCD is called to release some memory. Of course, if the HCD code has > > already been unloaded from the system this causes an oops, as you found > > out. > > Well, if the hcd module were to wait upon rmmod, then that would cause > rmmod to hang (right?), in turn causing a chicken-and-egg problem: The > rmmod would happen before the umount, so it would hang, waiting for the > umount, which is scripted to occur after the rmmod. ... unless a kernel > module can make itself appear to the rmmod utility to be complying with > the rmmod command and then quietly leave the kernel at a later time > (when all its business is concluded).
That's exactly right. It's possible to invent even tighter deadlocks than this one -- after all, this one could be cured by running umount from another process. For example, if USB bus #1 was on the EHCI controller, then "rmmod ehci-hcd </proc/bus/usb/001/001" would be an uncurable deadlock. The redirection would keep the USB device file open as long as rmmod was running, rmmod wouldn't be able to finish until the module was unloaded, and the module wouldn't be able to unload until the device file was closed. > > In fact, I don't know of any reason to > > rmmod any drivers upon shutdown. > > This seems to be the bottom line. > > I think I'll simply kluge it: I'll add a line that says "modprobe > ehci-hcd" to the script responsible for umounting local file systems > upon shutdown. *shrug* No, don't do that! You'll still have unflushed buffers and lack of a clean unmount. Instead you should get rid of the line that does the rmmod. Alan Stern ------------------------------------------------------- This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 Project Admins to receive an Apple iPod Mini FREE for your judgement on who ports your project to Linux PPC the best. Sponsored by IBM. Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
