diff --git a/src/afs/LINUX/osi_groups.c b/src/afs/LINUX/osi_groups.c index 997ec7a684..c0d8270279 100644 --- a/src/afs/LINUX/osi_groups.c +++ b/src/afs/LINUX/osi_groups.c @@ -617,13 +617,36 @@ struct key_type key_type_afs_pag = .destroy = afs_pag_destroy, }; +#ifdef EXPORTED_TASKLIST_LOCK +extern rwlock_t tasklist_lock __attribute__((weak)); +#endif + void osi_keyring_init(void) { struct task_struct *p; - +#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 p = find_task_by_pid(1); if (p && p->user->session_keyring) __key_type_keyring = p->user->session_keyring->type; +#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 register_key_type(&key_type_afs_pag); } diff --git a/src/rx/LINUX/rx_knet.c b/src/rx/LINUX/rx_knet.c index 8587b0d0ac..f1b366769a 100644 --- a/src/rx/LINUX/rx_knet.c +++ b/src/rx/LINUX/rx_knet.c @@ -213,30 +213,34 @@ osi_StopListener(void) struct task_struct *listener; extern int 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); -#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 while (rxk_ListenerPid) { - flush_signals(listener); - force_sig(SIGKILL, listener); +#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); + } +#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) + break; afs_osi_Sleep(&rxk_ListenerPid); } sock_release(rx_socket);