DEVEL15-linux-rcu-read-lock-export-20090623
authorMarc Dionne <marc.c.dionne@gmail.com>
Wed, 24 Jun 2009 22:54:04 +0000 (22:54 +0000)
committerDerrick Brashear <shadow@dementia.org>
Wed, 24 Jun 2009 22:54:04 +0000 (22:54 +0000)
LICENSE IPL10
FIXES 124986

deal with rcu_read_lock() becoming GPLONLY

(cherry picked from commit 0e718b642cedd1ebc799ada35960164c95c24280)

src/afs/LINUX/osi_groups.c
src/afs/afs_osi_gcpags.c
src/afs/afs_user.c

index 8dc3e1a..0df0661 100644 (file)
@@ -231,7 +231,7 @@ extern struct key_type key_type_keyring __attribute__((weak));
 static struct key_type *__key_type_keyring = &key_type_keyring;
 
 static int
-install_session_keyring(struct task_struct *task, struct key *keyring)
+install_session_keyring(struct key *keyring)
 {
     struct key *old;
     char desc[20];
@@ -245,21 +245,21 @@ install_session_keyring(struct task_struct *task, struct key *keyring)
 
        /* create an empty session keyring */
        not_in_quota = KEY_ALLOC_IN_QUOTA;
-       sprintf(desc, "_ses.%u", task->tgid);
+       sprintf(desc, "_ses.%u", current->tgid);
 
 #if defined(KEY_ALLOC_NEEDS_STRUCT_TASK)
        keyring = key_alloc(__key_type_keyring, desc,
-                           task_uid(task), task_gid(task), task,
+                           current_uid(), current_gid(), current,
                            (KEY_POS_ALL & ~KEY_POS_SETATTR) | KEY_USR_ALL,
                            not_in_quota);
 #elif defined(KEY_ALLOC_NEEDS_CRED)
        keyring = key_alloc(__key_type_keyring, desc,
-                           task_uid(task), task_gid(task), current_cred(),
+                           current_uid(), current_gid(), current_cred(),
                            (KEY_POS_ALL & ~KEY_POS_SETATTR) | KEY_USR_ALL,
                            not_in_quota);
 #else
        keyring = key_alloc(__key_type_keyring, desc,
-                           task_uid(task), task_gid(task),
+                           current_uid(), current_gid(),
                            (KEY_POS_ALL & ~KEY_POS_SETATTR) | KEY_USR_ALL,
                            not_in_quota);
 #endif
@@ -276,11 +276,11 @@ install_session_keyring(struct task_struct *task, struct key *keyring)
     }
 
     /* install the keyring */
-    spin_lock_irq(&task->sighand->siglock);
-    old = task_session_keyring(task);
+    spin_lock_irq(&current->sighand->siglock);
+    old = task_session_keyring(current);
     smp_wmb();
-    task_session_keyring(task) = keyring;
-    spin_unlock_irq(&task->sighand->siglock);
+    task_session_keyring(current) = keyring;
+    spin_unlock_irq(&current->sighand->siglock);
 
     if (old)
            key_put(old);
@@ -660,7 +660,10 @@ void osi_keyring_init(void)
 #if defined(EXPORTED_FIND_TASK_BY_PID)
        p = find_task_by_pid(1);
 #else
+       p = pid_task(1, PIDTYPE_PID);
+/*
        p = find_task_by_vpid(1);
+*/
 #endif
        if (p && task_user(p)->session_keyring)
            __key_type_keyring = task_user(p)->session_keyring->type;
index b0e42cf..41aaa93 100644 (file)
@@ -232,7 +232,7 @@ extern rwlock_t tasklist_lock __attribute__((weak));
 void
 afs_osi_TraverseProcTable()
 {
-#if !defined(LINUX_KEYRING_SUPPORT)
+#if !defined(LINUX_KEYRING_SUPPORT) && (!defined(STRUCT_TASK_HAS_CRED) || defined(EXPORTED_RCU_READ_LOCK))
     struct task_struct *p;
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) && defined(EXPORTED_TASKLIST_LOCK)
@@ -499,6 +499,7 @@ afs_osi_proc2cred(AFS_PROC * pr)
     return rv;
 }
 #elif defined(AFS_LINUX22_ENV)
+#if !defined(LINUX_KEYRING_SUPPORT) && (!defined(STRUCT_TASK_HAS_CRED) || defined(EXPORTED_RCU_READ_LOCK))
 const struct AFS_UCRED *
 afs_osi_proc2cred(AFS_PROC * pr)
 {
@@ -531,6 +532,7 @@ afs_osi_proc2cred(AFS_PROC * pr)
 
     return rv;
 }
+#endif
 #else
 const struct AFS_UCRED *
 afs_osi_proc2cred(AFS_PROC * pr)
@@ -545,5 +547,6 @@ afs_osi_proc2cred(AFS_PROC * pr)
     return rv;
 }
 #endif
+#endif
 
 #endif /* AFS_GCPAGS */
index 2d6a53f..fe9a518 100644 (file)
@@ -564,7 +564,7 @@ afs_SetPrimary(register struct unixuser *au, register int aflag)
 }                              /*afs_SetPrimary */
 
 
-#if AFS_GCPAGS
+#if defined(AFS_GCPAGS)
 
 /*
  * Called by osi_TraverseProcTable (from afs_GCPAGs) for each 
@@ -593,6 +593,7 @@ static size_t afs_GCPAGs_cred_count = 0;
 /*
  * LOCKS: afs_GCPAGs_perproc_func requires write lock on afs_xuser
  */
+#if !defined(LINUX_KEYRING_SUPPORT) && (!defined(STRUCT_TASK_HAS_CRED) || defined(EXPORTED_RCU_READ_LOCK))
 void
 afs_GCPAGs_perproc_func(AFS_PROC * pproc)
 {
@@ -641,6 +642,7 @@ afs_GCPAGs_perproc_func(AFS_PROC * pproc)
        }
     }
 }
+#endif
 
 /*
  * Go through the process table, find all unused PAGs