linux-rx-kernel-listener-kill-task-directly-20080130
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Wed, 30 Jan 2008 17:25:42 +0000 (17:25 +0000)
committerDerrick Brashear <shadow@dementia.org>
Wed, 30 Jan 2008 17:25:42 +0000 (17:25 +0000)
LICENSE IPL10

based on work from shadow@dementia.org

since the tasklist lock and rcu stuff can/will be de-exported, and we don't
need it anyway...

src/afs/LINUX/osi_misc.c
src/rx/LINUX/rx_knet.c
src/rx/rx_kcommon.c

index 79314e7..76914b1 100644 (file)
@@ -65,8 +65,6 @@ afs_osi_SetTime(osi_timeval_t * tvp)
 #endif
 }
 
-struct task_struct *rxk_ListenerTask;
-
 void
 osi_linux_mask(void)
 {
@@ -76,13 +74,6 @@ osi_linux_mask(void)
     SIG_UNLOCK(current);
 }
 
-void
-osi_linux_rxkreg(void)
-{
-    rxk_ListenerTask = current;
-}
-
-
 #if defined(AFS_LINUX24_ENV)
 /* LOOKUP_POSITIVE is becoming the default */
 #ifndef LOOKUP_POSITIVE
index 9d3b4ad..ab1ec2b 100644 (file)
@@ -216,36 +216,16 @@ osi_StopListener(void)
 {
     struct task_struct *listener;
     extern int rxk_ListenerPid;
+    extern struct task_struct *rxk_ListenerTask;
 
-    while (rxk_ListenerPid) {
-#ifdef EXPORTED_TASKLIST_LOCK
-       if (&tasklist_lock)
-          read_lock(&tasklist_lock);
-#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-#ifdef EXPORTED_TASKLIST_LOCK
-       else
-#endif
-          rcu_read_lock();
-#endif
-       listener = find_task_by_pid(rxk_ListenerPid);
-        if (listener) {
-           flush_signals(listener);
-           force_sig(SIGKILL, listener);
+    while (rxk_ListenerTask) {
+        if (rxk_ListenerTask) {
+           flush_signals(rxk_ListenerTask);
+           force_sig(SIGKILL, rxk_ListenerTask);
        }
-#ifdef EXPORTED_TASKLIST_LOCK
-       if (&tasklist_lock)
-           read_unlock(&tasklist_lock);
-#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-#ifdef EXPORTED_TASKLIST_LOCK
-       else
-#endif
-          rcu_read_unlock();
-#endif
-       if (!listener)
+       if (!rxk_ListenerTask)
            break;
-       afs_osi_Sleep(&rxk_ListenerPid);
+       afs_osi_Sleep(&rxk_ListenerTask);
     }
     sock_release(rx_socket);
     rx_socket = NULL;
index 8c6eda6..70ac504 100644 (file)
@@ -1202,6 +1202,9 @@ rxk_ReadPacket(osi_socket so, struct rx_packet *p, int *host, int *port)
  * OS's socket receive routine returns as a result of a signal.
  */
 int rxk_ListenerPid;           /* Used to signal process to wakeup at shutdown */
+#ifdef AFS_LINUX20_ENV
+struct task_struct *rxk_ListenerTask;
+#endif
 
 #ifdef AFS_SUN5_ENV
 /*
@@ -1231,6 +1234,7 @@ rxk_Listener(void)
 
 #ifdef AFS_LINUX20_ENV
     rxk_ListenerPid = current->pid;
+    rxk_ListenerTask = current;
 #endif
 #ifdef AFS_SUN5_ENV
     rxk_ListenerPid = 1;       /* No PID, just a flag that we're alive */
@@ -1267,7 +1271,11 @@ rxk_Listener(void)
        osi_rxWakeup(&afs_termState);
     }
     rxk_ListenerPid = 0;
-#if defined(AFS_LINUX22_ENV) || defined(AFS_SUN5_ENV)
+#ifdef AFS_LINUX20_ENV
+    rxk_ListenerTask = 0;
+    osi_rxWakeup(&rxk_ListenerTask);
+#endif
+#if defined(AFS_SUN5_ENV)
     osi_rxWakeup(&rxk_ListenerPid);
 #endif
 #ifdef AFS_SUN5_ENV