+static void call_security_inode_permission(void *args)
+{
+ struct security_inode_permission_args *a = args;
-+ LKTRTrace("fsuid %d\n", current->fsuid);
++ LKTRTrace("fsuid %d\n", current_fsuid());
+ *a->errp = vfsub_security_inode_permission(a->h_inode, a->mask,
+ a->fake_nd);
+}
diff -urN linux/fs/aufs/export.c linux-aufs/fs/aufs/export.c
--- linux/fs/aufs/export.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-aufs/fs/aufs/export.c 2009-03-12 16:18:04.000000000 +0100
-@@ -0,0 +1,826 @@
+@@ -0,0 +1,827 @@
+/*
+ * Copyright (C) 2005-2009 Junjiro Okajima
+ *
+#include <linux/exportfs.h>
+#include <linux/mnt_namespace.h>
+#include <linux/random.h>
++#include <linux/nsproxy.h>
+#include "aufs.h"
+
+union conv {
+ if (nsi_lock)
+ si_read_unlock(parent->d_sb);
+ path_get(path);
-+ file = dentry_open(parent, path->mnt, au_dir_roflags);
++ file = dentry_open(parent, path->mnt, au_dir_roflags, file->f_cred);
+ dentry = (void *)file;
+ if (IS_ERR(file))
+ goto out;
+ if (file && au_test_nfs(h_dentry->d_sb))
+ h_file = au_h_intent(dentry, bindex, file);
+ if (!h_file)
-+ h_file = dentry_open(dget(h_dentry), mntget(br->br_mnt), flags);
++ h_file = dentry_open(dget(h_dentry), mntget(br->br_mnt), flags, current_cred());
+
+ /*
+ * a dirty trick for handling FMODE_EXEC and deny_write_access().
+
+int au_test_h_perm(struct inode *h_inode, int mask, int dlgt)
+{
-+ if (!current->fsuid)
++ if (!current_fsuid())
+ return 0;
+ /* todo: fake nameidata? */
+ return vfsub_permission(h_inode, mask, NULL, dlgt);
+ */
+ vfsub_args_init(&vargs, &ign, dlgt,
+ (h_dir->i_mode & S_ISVTX)
-+ && wh_dentry->d_inode->i_uid != current->fsuid);
++ && wh_dentry->d_inode->i_uid != current_fsuid());
+ vfsub_ign_hinode(&vargs, IN_DELETE, hdir);
+ err = vfsub_unlink(h_dir, wh_dentry, &vargs);
+ AuTraceErr(err);
+ struct vfsub_args vargs;
+
+ AuTraceEnter();
-+ AuDebugOn(current->fsuid);
++ AuDebugOn(current_fsuid());
+
+ err = 0;
+ wbr = a->br->br_wbr;
diff -urN linux/fs/aufs/wkq.c linux-aufs/fs/aufs/wkq.c
--- linux/fs/aufs/wkq.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-aufs/fs/aufs/wkq.c 2009-03-12 16:18:04.000000000 +0100
-@@ -0,0 +1,366 @@
+@@ -0,0 +1,353 @@
+/*
+ * Copyright (C) 2005-2009 Junjiro Okajima
+ *
+
+struct au_cred {
+#ifdef CONFIG_AUFS_DLGT
-+ int umask;
-+ uid_t fsuid;
-+ gid_t fsgid;
-+ kernel_cap_t cap_effective, cap_inheritable, cap_permitted;
++ struct cred *cred;
+#if 0 /* reserved for future use */
+ unsigned keep_capabilities:1;
+ struct user_struct *user;
+#ifdef CONFIG_AUFS_DLGT
+static void cred_store(struct au_cred *cred)
+{
-+ cred->umask = current->fs->umask;
-+ cred->fsuid = current->fsuid;
-+ cred->fsgid = current->fsgid;
-+ cred->cap_effective = current->cap_effective;
-+ cred->cap_inheritable = current->cap_inheritable;
-+ cred->cap_permitted = current->cap_permitted;
++ cred = get_current_cred();
+}
+
+static void cred_revert(struct au_cred *cred)
+{
+ AuDebugOn(!au_test_wkq(current));
-+ current->fs->umask = cred->umask;
-+ current->fsuid = cred->fsuid;
-+ current->fsgid = cred->fsgid;
-+ current->cap_effective = cred->cap_effective;
-+ current->cap_inheritable = cred->cap_inheritable;
-+ current->cap_permitted = cred->cap_permitted;
++ revert_creds(cred);
+}
+
+static void cred_switch(struct au_cred *old, struct au_cred *new)
+ goto out_dput;
+ }
+ file = dentry_open(dget(dentry), mntget(base_file->f_vfsmnt),
-+ O_RDWR | O_CREAT | O_EXCL | O_LARGEFILE);
++ O_RDWR | O_CREAT | O_EXCL | O_LARGEFILE, base_file->f_cred);
+ if (IS_ERR(file)) {
+ AuErr("%.*s open err %ld\n", AuLNPair(name), PTR_ERR(file));
+ goto out_dput;
diff -urN linux/fs/Makefile linux-aufs/fs/Makefile
--- linux/fs/Makefile 2009-03-12 11:25:26.000000000 +0100
+++ linux-aufs/fs/Makefile 2009-03-12 17:03:22.897115295 +0100
-@@ -89,6 +89,7 @@
- obj-$(CONFIG_HFS_FS) += hfs/
- obj-$(CONFIG_ECRYPT_FS) += ecryptfs/
- obj-$(CONFIG_UNION_FS) += unionfs/
+@@ -125,3 +125,4 @@
+ obj-$(CONFIG_BTRFS_FS) += btrfs/
+ obj-$(CONFIG_GFS2_FS) += gfs2/
+ obj-$(CONFIG_EXOFS_FS) += exofs/
+obj-$(CONFIG_AUFS) += aufs/
- obj-$(CONFIG_VXFS_FS) += freevxfs/
- obj-$(CONFIG_NFS_FS) += nfs/
- obj-$(CONFIG_EXPORTFS) += exportfs/
diff -urN linux/include/linux/aufs_type.h linux-aufs/include/linux/aufs_type.h
--- linux/include/linux/aufs_type.h 1970-01-01 01:00:00.000000000 +0100
+++ linux-aufs/include/linux/aufs_type.h 2009-03-12 16:18:04.000000000 +0100