[PATCH] fix ohci1394 rmmod

From: Paul Mackerras
Date: Tue May 04 2004 - 07:30:38 EST


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);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/