From: Olaf Hering <olh@suse.de>

Ben,

this sequence of commands will hang the final rmmod.

init=/bin/bash --login
mount proc
modprove -v ohci1394
rmmod ohci1394
modprobe -v ohci1394
rmmod ohci1394  ->  hangs

It is stuck here:

rmmod         D 0FF7D030     0  4518      1                4517 (NOTLB)
Call trace:
 [c000a188] __switch_to+0x48/0x70
 [c0171588] schedule+0x2b0/0x5d0
 [c0171b28] wait_for_completion+0x7c/0xec
 [e90492fc] nodemgr_remove_host+0x70/0x108 [ieee1394]
 [e904606c] __unregister_host+0xd8/0x10c [ieee1394]
 [e9046170] highlevel_remove_host+0x9c/0x15c [ieee1394]
 [e9044e7c] hpsb_remove_host+0x8c/0xdc [ieee1394]
 [e9065c80] ohci1394_pci_remove+0xd8/0x418 [ohci1394]
 [c00b487c] pci_device_remove+0x60/0x64
 [c00e8a68] device_release_driver+0x84/0x88
 [c00e8b1c] bus_remove_driver+0xb0/0x12c
 [c00e9270] driver_unregister+0x1c/0xa0
 [c00b4ac4] pci_unregister_driver+0x20/0x88
 [e9068698] ohci1394_cleanup+0x44/0x1054 [ohci1394]
 [c00352f8] sys_delete_module+0x1d0/0x2a8

knodemgrd_0 exits on the first rmmod, but leaves nodemgr_serialize
in down state. This patch fixes it for me.

Signed-off-by: Olaf Hering <olh@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/drivers/ieee1394/nodemgr.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff -puN drivers/ieee1394/nodemgr.c~rmmod-ohci1394-hangs drivers/ieee1394/nodemgr.c
--- 25/drivers/ieee1394/nodemgr.c~rmmod-ohci1394-hangs	Fri Sep 24 16:57:10 2004
+++ 25-akpm/drivers/ieee1394/nodemgr.c	Fri Sep 24 16:57:33 2004
@@ -1488,8 +1488,10 @@ static int nodemgr_host_thread(void *__h
 			break;
 		}
 
-		if (hi->kill_me)
+		if (hi->kill_me) {
+			up(&nodemgr_serialize);
 			break;
+		}
 
 		/* Pause for 1/4 second in 1/16 second intervals,
 		 * to make sure things settle down. */
@@ -1513,8 +1515,10 @@ static int nodemgr_host_thread(void *__h
 				i = 0;
 
 			/* Check the kill_me again */
-			if (hi->kill_me)
+			if (hi->kill_me) {
+				up(&nodemgr_serialize);
 				goto caught_signal;
+			}
 		}
 
 		if (!nodemgr_check_irm_capability(host, reset_cycles)) {
_