linux-proc-walk-locking-20081012

LICENSE IPL10
FIXES 116603

sort out rcu locking versus tasklist lock. if this fails we probably have to
disable walking entirely
This commit is contained in:
Derrick Brashear 2008-10-12 19:44:27 +00:00
parent 0195d7c082
commit 24ce8010cd

View File

@ -234,17 +234,18 @@ afs_osi_TraverseProcTable()
{
#if !defined(LINUX_KEYRING_SUPPORT)
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
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) && defined(EXPORTED_TASKLIST_LOCK)
if (&tasklist_lock)
read_lock(&tasklist_lock);
#endif /* EXPORTED_TASKLIST_LOCK */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) && defined(EXPORTED_TASKLIST_LOCK)
else
#endif /* EXPORTED_TASKLIST_LOCK && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) */
rcu_read_lock();
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) */
#ifdef DEFINED_FOR_EACH_PROCESS
for_each_process(p) if (p->pid) {
#ifdef STRUCT_TASK_STRUCT_HAS_EXIT_STATE
@ -268,16 +269,16 @@ afs_osi_TraverseProcTable()
afs_GCPAGs_perproc_func(p);
}
#endif
#ifdef EXPORTED_TASKLIST_LOCK
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) && defined(EXPORTED_TASKLIST_LOCK)
if (&tasklist_lock)
read_unlock(&tasklist_lock);
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
#ifdef EXPORTED_TASKLIST_LOCK
read_unlock(&tasklist_lock);
#endif /* EXPORTED_TASKLIST_LOCK */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) && defined(EXPORTED_TASKLIST_LOCK)
else
#endif
#endif /* EXPORTED_TASKLIST_LOCK && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) */
rcu_read_unlock();
#endif
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) */
#endif
}
#endif