public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix ohci1394 rmmod
@ 2004-05-04 12:07 Paul Mackerras
  2004-05-04 12:39 ` Ben Collins
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Mackerras @ 2004-05-04 12:07 UTC (permalink / raw)
  To: akpm, torvalds, bcollins, linux-kernel, linux1394-devel

With the current ieee1394 code, if I try to rmmod the ohci1394 module,
it hangs forever.  The reason is that it is waiting for the knodemgr_n
kernel thread to exit.  The thread exits when it gets a signal, and
the mainline code has tried to send it a signal.  However, the thread
has called daemonize(), which sets the signal mask to all 1s, so no
signals ever get through.

The patch below fixes this by unblocking SIGTERM after the daemonize
call.  I looked around and found the same problem with the khpsbpkt
thread, so I applied the same fix there.  With this patch I can once
again successfully rmmod the ohci1394 module.

Ben, any comments on this patch?  I think it should go in.

Regards,
Paul.

diff -urN linux-2.5/drivers/ieee1394/ieee1394_core.c g5-ppc64/drivers/ieee1394/ieee1394_core.c
--- linux-2.5/drivers/ieee1394/ieee1394_core.c	2004-04-19 08:07:02.000000000 +1000
+++ g5-ppc64/drivers/ieee1394/ieee1394_core.c	2004-05-03 22:53:03.000000000 +1000
@@ -1017,9 +1017,15 @@
 	struct hpsb_packet *packet;
 	void (*complete_routine)(void*);
 	void *complete_data;
+	sigset_t sset;
 
 	daemonize("khpsbpkt");
 
+	/* Make us susceptible to SIGTERM */
+	sigemptyset(&sset);
+	sigaddset(&sset, SIGTERM);
+	sigprocmask(SIG_UNBLOCK, &sset, NULL);
+
 	while (!down_interruptible(&khpsbpkt_sig)) {
 		while ((skb = skb_dequeue(&hpsbpkt_queue)) != NULL) {
 			packet = (struct hpsb_packet *)skb->data;
diff -urN linux-2.5/drivers/ieee1394/nodemgr.c g5-ppc64/drivers/ieee1394/nodemgr.c
--- linux-2.5/drivers/ieee1394/nodemgr.c	2004-04-19 08:07:02.000000000 +1000
+++ g5-ppc64/drivers/ieee1394/nodemgr.c	2004-05-03 22:51:32.000000000 +1000
@@ -1464,10 +1464,16 @@
 	struct host_info *hi = (struct host_info *)__hi;
 	struct hpsb_host *host = hi->host;
 	int reset_cycles = 0;
+	sigset_t sset;
 
 	/* No userlevel access needed */
 	daemonize(hi->daemon_name);
 
+	/* Make us susceptible to SIGTERM */
+	sigemptyset(&sset);
+	sigaddset(&sset, SIGTERM);
+	sigprocmask(SIG_UNBLOCK, &sset, NULL);
+
 	/* Setup our device-model entries */
 	nodemgr_create_host_dev_files(host);
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-05-04 12:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-04 12:07 [PATCH] fix ohci1394 rmmod Paul Mackerras
2004-05-04 12:39 ` Ben Collins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox