linux-crref-held-longer-20050320
authorChas Williams <chas@cmf.nrl.navy.mil>
Sun, 20 Mar 2005 20:18:08 +0000 (20:18 +0000)
committerDerrick Brashear <shadow@dementia.org>
Sun, 20 Mar 2005 20:18:08 +0000 (20:18 +0000)
FIXES 17917

hold the cr ref longer
we were putting it too soon

src/afs/LINUX/osi_cred.c
src/afs/LINUX/osi_machdep.h

index 9cad716..6795d3f 100644 (file)
@@ -54,11 +54,11 @@ crget(void)
            osi_Panic("crget: No more memory for creds!\n");
 
        for (i = 0; i < CRED_ALLOC_STEP - 1; i++)
-           cred_pool[i].cr_ref = (long)&cred_pool[i + 1];
-       cred_pool[i].cr_ref = 0;
+           cred_pool[i].cr_next = (cred_t *) &cred_pool[i + 1];
+       cred_pool[i].cr_next = NULL;
     }
     tmp = cred_pool;
-    cred_pool = (cred_t *) tmp->cr_ref;
+    cred_pool = (cred_t *) tmp->cr_next;
     ncreds_inuse++;
     CRED_UNLOCK();
 
@@ -74,15 +74,15 @@ void
 crfree(cred_t * cr)
 {
     if (cr->cr_ref > 1) {
-#if defined(AFS_LINUX26_ENV)
-       put_group_info(cr->cr_group_info);
-#endif
        cr->cr_ref--;
        return;
     }
 
+#if defined(AFS_LINUX26_ENV)
+    put_group_info(cr->cr_group_info);
+#endif
     CRED_LOCK();
-    cr->cr_ref = (long)cred_pool;
+    cr->cr_next = (cred_t *) cred_pool;
     cred_pool = cr;
     CRED_UNLOCK();
     ncreds_inuse--;
index 03ba34e..e3c8c1a 100644 (file)
@@ -141,11 +141,7 @@ extern struct vnodeops afs_file_iops, afs_dir_iops, afs_symlink_iops;
 
 /* cred struct */
 typedef struct cred {          /* maps to task field: */
-#if (CPU == sparc64)
-    long cr_ref;
-#else
     int cr_ref;
-#endif
     uid_t cr_uid;              /* euid */
     uid_t cr_ruid;             /* uid */
     gid_t cr_gid;              /* egid */
@@ -156,6 +152,7 @@ typedef struct cred {               /* maps to task field: */
     gid_t cr_groups[NGROUPS];  /* 32 groups - empty set to NOGROUP */
     int cr_ngroups;
 #endif
+    struct cred *cr_next;
 } cred_t;
 #define AFS_UCRED cred
 #define AFS_PROC struct task_struct