Taken from upstream: STABLE14-linux-2629-20090115

===================================================================
RCS file: /cvs/openafs/acinclude.m4,v
retrieving revision 1.114.2.120
retrieving revision 1.114.2.121
diff -u -r1.114.2.120 -r1.114.2.121
--- openafs/acinclude.m4	2009/01/12 14:12:03	1.114.2.120
+++ openafs/acinclude.m4	2009/01/15 13:27:42	1.114.2.121
@@ -713,6 +713,8 @@
 		 LINUX_EXPORTS_PROC_ROOT_FS
                  LINUX_HAVE_CURRENT_KERNEL_TIME
                  LINUX_HAVE_WRITE_BEGIN_AOP
+                 LINUX_HAVE_GRAB_CACHE_PAGE_WRITE_BEGIN
+                 LINUX_STRUCT_TASK_HAS_CRED
                  LINUX_KMEM_CACHE_INIT
 		 LINUX_HAVE_KMEM_CACHE_T
 		 LINUX_KMEM_CACHE_CREATE_TAKES_DTOR
===================================================================
RCS file: /cvs/openafs/src/afs/LINUX/osi_cred.c,v
retrieving revision 1.10.2.3
retrieving revision 1.10.2.4
diff -u -r1.10.2.3 -r1.10.2.4
--- openafs/src/afs/LINUX/osi_cred.c	2006/12/19 02:29:56	1.10.2.3
+++ openafs/src/afs/LINUX/osi_cred.c	2009/01/15 13:27:43	1.10.2.4
@@ -79,15 +79,15 @@
 {
     cred_t *cr = crget();
 
-    cr->cr_uid = current->fsuid;
-    cr->cr_ruid = current->uid;
-    cr->cr_gid = current->fsgid;
-    cr->cr_rgid = current->gid;
+    cr->cr_uid = current_fsuid();
+    cr->cr_ruid = current_uid();
+    cr->cr_gid = current_fsgid();
+    cr->cr_rgid = current_gid();
 
 #if defined(AFS_LINUX26_ENV)
     task_lock(current);
-    get_group_info(current->group_info);
-    cr->cr_group_info = current->group_info;
+    get_group_info(current_group_info());
+    cr->cr_group_info = current_group_info();
     task_unlock(current);
 #else
     memcpy(cr->cr_groups, current->groups, NGROUPS * sizeof(gid_t));
@@ -101,10 +101,20 @@
 void
 crset(cred_t * cr)
 {
+#if defined(STRUCT_TASK_HAS_CRED)
+    struct cred *new_creds;
+
+    new_creds = prepare_creds();
+    new_creds->fsuid = cr->cr_uid;
+    new_creds->uid = cr->cr_ruid;
+    new_creds->fsgid = cr->cr_gid;
+    new_creds->gid = cr->cr_rgid;
+#else
     current->fsuid = cr->cr_uid;
     current->uid = cr->cr_ruid;
     current->fsgid = cr->cr_gid;
     current->gid = cr->cr_rgid;
+#endif
 #if defined(AFS_LINUX26_ENV)
 {
     struct group_info *old_info;
@@ -113,8 +123,14 @@
     get_group_info(cr->cr_group_info);
 
     task_lock(current);
+#if defined(STRUCT_TASK_HAS_CRED)
+    old_info = current->cred->group_info;
+    new_creds->group_info = cr->cr_group_info;
+    commit_creds(new_creds);
+#else
     old_info = current->group_info;
     current->group_info = cr->cr_group_info;
+#endif
     task_unlock(current);
 
     put_group_info(old_info);
===================================================================
RCS file: /cvs/openafs/src/afs/LINUX/osi_file.c,v
retrieving revision 1.19.2.18
retrieving revision 1.19.2.19
diff -u -r1.19.2.18 -r1.19.2.19
--- openafs/src/afs/LINUX/osi_file.c	2009/01/12 14:19:29	1.19.2.18
+++ openafs/src/afs/LINUX/osi_file.c	2009/01/15 13:27:43	1.19.2.19
@@ -78,7 +78,11 @@
 #endif
     tip->i_flags |= MS_NOATIME;	/* Disable updating access times. */
 
+#if defined(STRUCT_TASK_HAS_CRED)
+    filp = dentry_open(dp, mntget(afs_cacheMnt), O_RDWR, current_cred());
+#else
     filp = dentry_open(dp, mntget(afs_cacheMnt), O_RDWR);
+#endif
     if (IS_ERR(filp))
 	osi_Panic("Can't open inode %d\n", ainode);
     afile->filp = filp;
===================================================================
RCS file: /cvs/openafs/src/afs/LINUX/osi_groups.c,v
retrieving revision 1.25.2.16
retrieving revision 1.25.2.17
diff -u -r1.25.2.16 -r1.25.2.17
--- openafs/src/afs/LINUX/osi_groups.c	2008/06/09 03:39:44	1.25.2.16
+++ openafs/src/afs/LINUX/osi_groups.c	2009/01/15 13:27:43	1.25.2.17
@@ -50,7 +50,7 @@
 
     crset(*cr);
 
-#ifdef STRUCT_TASK_STRUCT_HAS_PARENT
+#if defined(STRUCT_TASK_STRUCT_HAS_PARENT) && !defined(STRUCT_TASK_HAS_CRED)
     if (change_parent) {
 	old_info = current->parent->group_info;
 	get_group_info(group_info);
@@ -246,12 +246,12 @@
 
 #ifdef KEY_ALLOC_NEEDS_STRUCT_TASK
 	keyring = key_alloc(__key_type_keyring, desc,
-			    task->uid, task->gid, task,
+			    task_uid(task), task_gid(task), task,
 			    (KEY_POS_ALL & ~KEY_POS_SETATTR) | KEY_USR_ALL,
 			    not_in_quota);
 #else
 	keyring = key_alloc(__key_type_keyring, desc,
-			    task->uid, task->gid,
+			    task_uid(task), task_gid(task),
 			    (KEY_POS_ALL & ~KEY_POS_SETATTR) | KEY_USR_ALL,
 			    not_in_quota);
 #endif
@@ -269,9 +269,9 @@
 
     /* install the keyring */
     spin_lock_irq(&task->sighand->siglock);
-    old = task->signal->session_keyring;
+    old = task_session_keyring(task);
     smp_wmb();
-    task->signal->session_keyring = keyring;
+    task_session_keyring(task) = keyring;
     spin_unlock_irq(&task->sighand->siglock);
 
     if (old)
@@ -337,7 +337,7 @@
 
 	(void) install_session_keyring(current, NULL);
 
-	if (current->signal->session_keyring) {
+	if (current_session_keyring()) {
 	    struct key *key;
 	    key_perm_t perm;
 
@@ -352,7 +352,7 @@
 
 	    if (!IS_ERR(key)) {
 		key_instantiate_and_link(key, (void *) newpag, sizeof(afs_uint32),
-					 current->signal->session_keyring, NULL);
+					 current_session_keyring(), NULL);
 		key_put(key);
 	    }
 	}
@@ -549,26 +549,28 @@
 {
     int code;
     afs_uint32 *userpag, pag = NOPAG;
+#ifndef AFS_LINUX26_ONEGROUP_ENV
     int g0, g1;
+#endif
 
     if (key->uid != 0 || key->gid != 0)
 	return -EPERM;
 
     code = -EINVAL;
-    get_group_info(current->group_info);
+    get_group_info(current_group_info());
 
     if (datalen != sizeof(afs_uint32) || !data)
 	goto error;
 
-    if (current->group_info->ngroups < NUMPAGGROUPS)
+    if (current_group_info()->ngroups < NUMPAGGROUPS)
 	goto error;
 
     /* ensure key being set matches current pag */
 #ifdef AFS_LINUX26_ONEGROUP_ENV
-    pag = afs_get_pag_from_groups(current->group_info);
+    pag = afs_get_pag_from_groups(current_group_info());
 #else
-    g0 = GROUP_AT(current->group_info, 0);
-    g1 = GROUP_AT(current->group_info, 1);
+    g0 = GROUP_AT(current_group_info(), 0);
+    g1 = GROUP_AT(current_group_info(), 1);
 
     pag = afs_get_pag_from_groups(g0, g1);
 #endif
@@ -584,7 +586,7 @@
     code = 0;
 
 error:
-    put_group_info(current->group_info);
+    put_group_info(current_group_info());
     return code;
 }
 
@@ -651,8 +653,8 @@
 #else
 	p = find_task_by_vpid(1);
 #endif
-	if (p && p->user->session_keyring)
-	    __key_type_keyring = p->user->session_keyring->type;
+	if (p && task_user(p)->session_keyring)
+	    __key_type_keyring = task_user(p)->session_keyring->type;
 # ifdef EXPORTED_TASKLIST_LOCK
 	if (&tasklist_lock)
 	    read_unlock(&tasklist_lock);
===================================================================
RCS file: /cvs/openafs/src/afs/LINUX/osi_machdep.h,v
retrieving revision 1.22.2.18
retrieving revision 1.22.2.19
diff -u -r1.22.2.18 -r1.22.2.19
--- openafs/src/afs/LINUX/osi_machdep.h	2007/11/23 13:45:04	1.22.2.18
+++ openafs/src/afs/LINUX/osi_machdep.h	2009/01/15 13:27:43	1.22.2.19
@@ -155,7 +155,7 @@
 #endif
 
 /* cred struct */
-typedef struct cred {		/* maps to task field: */
+typedef struct afs_cred {		/* maps to task field: */
     int cr_ref;
     uid_t cr_uid;		/* euid */
     uid_t cr_ruid;		/* uid */
@@ -167,10 +167,34 @@
     gid_t cr_groups[NGROUPS];	/* 32 groups - empty set to NOGROUP */
     int cr_ngroups;
 #endif
-    struct cred *cr_next;
+    struct afs_cred *cr_next;
 } cred_t;
-#define AFS_UCRED cred
+#define AFS_UCRED afs_cred
 #define AFS_PROC struct task_struct
+#if !defined(current_cred)
+#define current_gid() (current->gid)
+#define current_uid() (current->uid)
+#define current_fsgid() (current->fsgid)
+#define current_fsuid() (current->fsuid)
+#endif
+#if defined(STRUCT_TASK_HAS_CRED)
+#define current_group_info() (current->cred->group_info)
+#define task_gid(task) (task->cred->gid)
+#define task_user(task) (task->cred->user)
+#define task_session_keyring(task) (task->cred->tgcred->session_keyring)
+#define current_session_keyring() (current->cred->tgcred->session_keyring)
+#else
+#define current_group_info() (current->group_info)
+#if !defined(task_gid)
+#define task_gid(task) (task->gid)
+#endif
+#if !defined(task_uid)
+#define task_uid(task) (task->uid)
+#endif
+#define task_user(task) (task->user)
+#define task_session_keyring(task) (task->signal->session_keyring)
+#define current_session_keyring() (current->signal->session_keyring)
+#endif
 #define crhold(c) (c)->cr_ref++
 
 /* UIO manipulation */
===================================================================
RCS file: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v
retrieving revision 1.81.2.74
retrieving revision 1.81.2.75
diff -u -r1.81.2.74 -r1.81.2.75
--- openafs/src/afs/LINUX/osi_vnodeops.c	2009/01/09 14:58:03	1.81.2.74
+++ openafs/src/afs/LINUX/osi_vnodeops.c	2009/01/15 13:27:43	1.81.2.75
@@ -1791,7 +1791,11 @@
 {
     struct page *page;
     pgoff_t index = pos >> PAGE_CACHE_SHIFT;
+#if defined(HAVE_GRAB_CACHE_PAGE_WRITE_BEGIN)
+    page = grab_cache_page_write_begin(mapping, index, flags);
+#else
     page = __grab_cache_page(mapping, index);
+#endif
     *pagep = page;
 
     return 0;
===================================================================
RCS file: /cvs/openafs/src/afs/afs_nfsdisp.c,v
retrieving revision 1.18.2.4
retrieving revision 1.18.2.5
diff -u -r1.18.2.4 -r1.18.2.5
--- openafs/src/afs/afs_nfsdisp.c	2008/08/13 23:49:37	1.18.2.4
+++ openafs/src/afs/afs_nfsdisp.c	2009/01/15 13:27:43	1.18.2.5
@@ -378,8 +378,8 @@
 afs_nfs2_getattr(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call = afs_nfs2_dispatcher(0, RFS_GETATTR, (char *)args, &exp, rp, crp);
     if (call > 1)
 	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
@@ -393,8 +393,8 @@
 afs_nfs2_setattr(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call = afs_nfs2_dispatcher(0, RFS_SETATTR, (char *)args, &exp, rp, crp);
     if (call > 1)
 	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
@@ -408,8 +408,8 @@
 afs_nfs2_lookup(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call = afs_nfs2_dispatcher(0, RFS_LOOKUP, (char *)args, &exp, rp, crp);
     if (call > 1)
 	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
@@ -426,8 +426,8 @@
 afs_nfs2_readlink(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call = afs_nfs2_dispatcher(0, RFS_READLINK, (char *)args, &exp, rp, crp);
     if (call > 1)
 	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
@@ -441,8 +441,8 @@
 afs_nfs2_read(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call = afs_nfs2_dispatcher(0, RFS_READ, (char *)args, &exp, rp, crp);
     if (call > 1)
 	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
@@ -456,8 +456,8 @@
 afs_nfs2_write(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call = afs_nfs2_dispatcher(0, RFS_WRITE, (char *)args, &exp, rp, crp);
     if (call > 1)
 	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
@@ -471,8 +471,8 @@
 afs_nfs2_create(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call = afs_nfs2_dispatcher(0, RFS_CREATE, (char *)args, &exp, rp, crp);
     if (call > 1)
 	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
@@ -489,8 +489,8 @@
 afs_nfs2_remove(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call = afs_nfs2_dispatcher(0, RFS_REMOVE, (char *)args, &exp, rp, crp);
     if (call > 1)
 	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
@@ -504,8 +504,8 @@
 afs_nfs2_rename(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call = afs_nfs2_dispatcher(0, RFS_RENAME, (char *)args, &exp, rp, crp);
     if (call > 1)
 	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
@@ -519,8 +519,8 @@
 afs_nfs2_link(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call = afs_nfs2_dispatcher(0, RFS_LINK, (char *)args, &exp, rp, crp);
     if (call > 1)
 	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
@@ -534,8 +534,8 @@
 afs_nfs2_symlink(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call = afs_nfs2_dispatcher(0, RFS_SYMLINK, (char *)args, &exp, rp, crp);
     if (call > 1)
 	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
@@ -549,8 +549,8 @@
 afs_nfs2_mkdir(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call = afs_nfs2_dispatcher(0, RFS_MKDIR, (char *)args, &exp, rp, crp);
     if (call > 1)
 	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
@@ -567,8 +567,8 @@
 afs_nfs2_rmdir(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call = afs_nfs2_dispatcher(0, RFS_RMDIR, (char *)args, &exp, rp, crp);
     if (call > 1)
 	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
@@ -582,8 +582,8 @@
 afs_nfs2_readdir(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call = afs_nfs2_dispatcher(0, RFS_READDIR, (char *)args, &exp, rp, crp);
     if (call > 1)
 	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
@@ -597,8 +597,8 @@
 afs_nfs2_statfs(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call = afs_nfs2_dispatcher(0, RFS_STATFS, (char *)args, &exp, rp, crp);
     if (call > 1)
 	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
@@ -633,8 +633,8 @@
 afs_acl2_getacl(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call =
 	afs_nfs2_dispatcher(1, ACLPROC2_GETACL, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -650,8 +650,8 @@
 afs_acl2_setacl(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call =
 	afs_nfs2_dispatcher(1, ACLPROC2_SETACL, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -667,8 +667,8 @@
 afs_acl2_getattr(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call =
 	afs_nfs2_dispatcher(1, ACLPROC2_GETATTR, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -684,8 +684,8 @@
 afs_acl2_access(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call =
 	afs_nfs2_dispatcher(1, ACLPROC2_ACCESS, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -702,8 +702,8 @@
 afs_acl2_getxattrdir(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call =
 	afs_nfs2_dispatcher(1, ACLPROC2_GETXATTRDIR, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1140,8 +1140,8 @@
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call =
 	afs_nfs3_dispatcher(0, NFSPROC3_GETATTR, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1158,8 +1158,8 @@
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call =
 	afs_nfs3_dispatcher(0, NFSPROC3_SETATTR, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1176,8 +1176,8 @@
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call =
 	afs_nfs3_dispatcher(0, NFSPROC3_LOOKUP, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1199,8 +1199,8 @@
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call =
 	afs_nfs3_dispatcher(0, NFSPROC3_ACCESS, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1217,8 +1217,8 @@
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call =
 	afs_nfs3_dispatcher(0, NFSPROC3_READLINK, (char *)args, &exp, rp,
 			    crp);
@@ -1236,8 +1236,8 @@
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call = afs_nfs3_dispatcher(0, NFSPROC3_READ, (char *)args, &exp, rp, crp);
     if (call > 1)
 	afs_nfs3_noaccess((struct afs_nfs3_resp *)xp);
@@ -1253,8 +1253,8 @@
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call =
 	afs_nfs3_dispatcher(0, NFSPROC3_WRITE, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1271,8 +1271,8 @@
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call =
 	afs_nfs3_dispatcher(0, NFSPROC3_CREATE, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1294,8 +1294,8 @@
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call =
 	afs_nfs3_dispatcher(0, NFSPROC3_MKDIR, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1317,8 +1317,8 @@
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call =
 	afs_nfs3_dispatcher(0, NFSPROC3_SYMLINK, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1340,8 +1340,8 @@
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call =
 	afs_nfs3_dispatcher(0, NFSPROC3_MKNOD, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1363,8 +1363,8 @@
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call =
 	afs_nfs3_dispatcher(0, NFSPROC3_REMOVE, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1381,8 +1381,8 @@
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call =
 	afs_nfs3_dispatcher(0, NFSPROC3_RMDIR, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1399,8 +1399,8 @@
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call =
 	afs_nfs3_dispatcher(0, NFSPROC3_RENAME, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1417,8 +1417,8 @@
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call = afs_nfs3_dispatcher(0, NFSPROC3_LINK, (char *)args, &exp, rp, crp);
     if (call > 1)
 	afs_nfs3_noaccess((struct afs_nfs3_resp *)xp);
@@ -1434,8 +1434,8 @@
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call =
 	afs_nfs3_dispatcher(0, NFSPROC3_READDIR, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1452,8 +1452,8 @@
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call =
 	afs_nfs3_dispatcher(0, NFSPROC3_READDIRPLUS, (char *)args, &exp, rp,
 			    crp);
@@ -1473,8 +1473,8 @@
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call =
 	afs_nfs3_dispatcher(0, NFSPROC3_FSSTAT, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1491,8 +1491,8 @@
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call =
 	afs_nfs3_dispatcher(0, NFSPROC3_FSINFO, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1509,8 +1509,8 @@
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call =
 	afs_nfs3_dispatcher(0, NFSPROC3_PATHCONF, (char *)args, &exp, rp,
 			    crp);
@@ -1528,8 +1528,8 @@
 {
     u_int call;
     afs_nfs3_resp dummy;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call =
 	afs_nfs3_dispatcher(0, NFSPROC3_COMMIT, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1570,8 +1570,8 @@
 afs_acl3_getacl(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call =
 	afs_nfs3_dispatcher(1, ACLPROC3_GETACL, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1587,8 +1587,8 @@
 afs_acl3_setacl(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call =
 	afs_nfs3_dispatcher(1, ACLPROC3_SETACL, (char *)args, &exp, rp, crp);
     if (call > 1)
@@ -1605,8 +1605,8 @@
 afs_acl3_getxattrdir(char *args, char *xp, char *exp, char *rp, char *crp)
 {
     u_int call;
-    struct cred *svcred = curthread->t_cred;
-    curthread->t_cred = (struct cred *)crp;
+    struct AFS_UCRED *svcred = curthread->t_cred;
+    curthread->t_cred = (struct AFS_UCRED *)crp;
     call =
 	afs_nfs3_dispatcher(1, ACLPROC3_GETXATTRDIR, (char *)args, &exp, rp, crp);
     if (call > 1)
===================================================================
RCS file: /cvs/openafs/src/afs/afs_osi.c,v
retrieving revision 1.48.2.18
retrieving revision 1.48.2.19
diff -u -r1.48.2.18 -r1.48.2.19
--- openafs/src/afs/afs_osi.c	2008/10/12 18:44:46	1.48.2.18
+++ openafs/src/afs/afs_osi.c	2009/01/15 13:27:43	1.48.2.19
@@ -1120,10 +1120,15 @@
 	|| (pr->state == TASK_UNINTERRUPTIBLE)
 	|| (pr->state == TASK_STOPPED)) {
 	cr.cr_ref = 1;
-	cr.cr_uid = pr->uid;
+	cr.cr_uid = task_uid(pr);
 #if defined(AFS_LINUX26_ENV)
+#if defined(STRUCT_TASK_HAS_CRED)
+	get_group_info(pr->cred->group_info);
+	cr.cr_group_info = pr->cred->group_info;
+#else
 	get_group_info(pr->group_info);
 	cr.cr_group_info = pr->group_info;
+#endif
 #else
 	cr.cr_ngroups = pr->ngroups;
 	memcpy(cr.cr_groups, pr->groups, NGROUPS * sizeof(gid_t));
===================================================================
RCS file: /cvs/openafs/src/cf/linux-test4.m4,v
retrieving revision 1.20.2.52
retrieving revision 1.20.2.53
diff -u -r1.20.2.52 -r1.20.2.53
--- openafs/src/cf/linux-test4.m4	2009/01/09 14:58:02	1.20.2.52
+++ openafs/src/cf/linux-test4.m4	2009/01/15 13:27:44	1.20.2.53
@@ -1073,3 +1073,32 @@
   if test "x$ac_cv_linux_write_begin" = "xyes"; then
     AC_DEFINE([HAVE_WRITE_BEGIN], 1, [define if your kernel has a write_begin() address space op])
   fi])
+
+AC_DEFUN([LINUX_HAVE_GRAB_CACHE_PAGE_WRITE_BEGIN], [
+  AC_MSG_CHECKING([for linux grab_cache_page_write_begin()])
+  AC_CACHE_VAL([ac_cv_linux_grab_cache_page_write_begin], [
+    AC_TRY_KBUILD(
+[#include <linux/pagemap.h>],
+[grab_cache_page_write_begin(NULL, 0, 0);],
+      ac_cv_linux_grab_cache_page_write_begin=yes,
+      ac_cv_linux_grab_cache_page_write_begin=no)])
+  AC_MSG_RESULT($ac_cv_linux_grab_cache_page_write_begin)
+  if test "x$ac_cv_linux_grab_cache_page_write_begin" = "xyes"; then
+    AC_DEFINE([HAVE_GRAB_CACHE_PAGE_WRITE_BEGIN], 1, [define if your kernel has grab_cache_page_write_begin()])
+  fi])
+
+AC_DEFUN([LINUX_STRUCT_TASK_HAS_CRED], [
+  AC_MSG_CHECKING([if struct task has cred])
+  AC_CACHE_VAL([ac_cv_linux_struct_task_has_cred], [
+    AC_TRY_KBUILD(
+[#include <linux/sched.h>
+#include <linux/cred.h>],
+[struct task_struct _t;
+uid_t _u;
+_u =_t.cred->uid ;],
+      ac_cv_linux_struct_task_has_cred=yes,
+      ac_cv_linux_struct_task_has_cred=no)])
+  AC_MSG_RESULT($ac_cv_linux_struct_task_has_cred)
+  if test "x$ac_cv_linux_struct_task_has_cred" = "xyes"; then
+    AC_DEFINE([STRUCT_TASK_HAS_CRED], 1, [define if struct task has a cred pointer])
+  fi])
