From: Simon Wilkinson Date: Wed, 30 Jan 2008 17:26:22 +0000 (+0000) Subject: STABLE14-linux-rx-kernel-listener-kill-task-directly-20080130 X-Git-Tag: openafs-stable-1_4_7pre1~50 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=8f62f0339f9467df25a018d36a15d82b9f452867;p=packages%2Fo%2Fopenafs.git STABLE14-linux-rx-kernel-listener-kill-task-directly-20080130 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... (cherry picked from commit c5afa335a8ffb86cf17c32173eb0e1c26500dd80) --- diff --git a/src/afs/LINUX/osi_misc.c b/src/afs/LINUX/osi_misc.c index 09b3f2285..7bc45c61d 100644 --- a/src/afs/LINUX/osi_misc.c +++ b/src/afs/LINUX/osi_misc.c @@ -348,8 +348,6 @@ osi_linux_free_inode_pages(void) } } -struct task_struct *rxk_ListenerTask; - void osi_linux_mask(void) { @@ -358,9 +356,3 @@ osi_linux_mask(void) RECALC_SIGPENDING(current); SIG_UNLOCK(current); } - -void -osi_linux_rxkreg(void) -{ - rxk_ListenerTask = current; -} diff --git a/src/rx/LINUX/rx_knet.c b/src/rx/LINUX/rx_knet.c index 9d3b4ada2..ab1ec2b07 100644 --- a/src/rx/LINUX/rx_knet.c +++ b/src/rx/LINUX/rx_knet.c @@ -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; diff --git a/src/rx/rx_kcommon.c b/src/rx/rx_kcommon.c index f7572d7da..4c056ff96 100644 --- a/src/rx/rx_kcommon.c +++ b/src/rx/rx_kcommon.c @@ -1206,6 +1206,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 /* @@ -1235,6 +1238,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 */ @@ -1271,7 +1275,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