From 928ad0445e91ecbfcd32a26e8c17b90ee0d83700 Mon Sep 17 00:00:00 2001 From: Jeffrey Hutzelman Date: Fri, 22 Sep 2006 12:16:24 +0000 Subject: [PATCH] tasklist-lock-redux-20060922 try tasklist_lock weak binding in osi_probe if no tasklist_lock, fall back to rcu locking --- src/afs/LINUX/osi_probe.c | 1 + src/afs/afs_osi_gcpags.c | 9 +++++++++ src/rx/LINUX/rx_knet.c | 8 ++++++++ 3 files changed, 18 insertions(+), 0 deletions(-) diff --git a/src/afs/LINUX/osi_probe.c b/src/afs/LINUX/osi_probe.c index 3b30fdd..20acb39 100644 --- a/src/afs/LINUX/osi_probe.c +++ b/src/afs/LINUX/osi_probe.c @@ -245,6 +245,7 @@ extern asmlinkage long sys_exit (int) __attribute__((weak)); extern asmlinkage long sys_open (const char *, int, int) __attribute__((weak)); #endif extern asmlinkage long sys_ioctl(unsigned int, unsigned int, unsigned long) __attribute__((weak)); +extern rwlock_t tasklist_lock __attribute__((weak)); /* Structures used to control probing. We put all the details of which diff --git a/src/afs/afs_osi_gcpags.c b/src/afs/afs_osi_gcpags.c index 3c8cfbb..c5df931 100644 --- a/src/afs/afs_osi_gcpags.c +++ b/src/afs/afs_osi_gcpags.c @@ -233,6 +233,11 @@ afs_osi_TraverseProcTable() struct task_struct *p; if (&tasklist_lock) read_lock(&tasklist_lock); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) + else + rcu_read_lock(); +#endif + #ifdef DEFINED_FOR_EACH_PROCESS for_each_process(p) if (p->pid) { #ifdef STRUCT_TASK_STRUCT_HAS_EXIT_STATE @@ -258,6 +263,10 @@ afs_osi_TraverseProcTable() #endif if (&tasklist_lock) read_unlock(&tasklist_lock); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) + else + rcu_read_unlock(); +#endif } #endif diff --git a/src/rx/LINUX/rx_knet.c b/src/rx/LINUX/rx_knet.c index b0b7d9c..4e176f6 100644 --- a/src/rx/LINUX/rx_knet.c +++ b/src/rx/LINUX/rx_knet.c @@ -209,9 +209,17 @@ osi_StopListener(void) if (&tasklist_lock) read_lock(&tasklist_lock); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) + else + rcu_read_lock(); +#endif listener = find_task_by_pid(rxk_ListenerPid); if (&tasklist_lock) read_unlock(&tasklist_lock); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) + else + rcu_read_unlock(); +#endif while (rxk_ListenerPid) { flush_signals(listener); force_sig(SIGKILL, listener); -- 1.7.1