CRED: Wrap task credential accesses in 9P2000 filesystem
authorDavid Howells <dhowells@redhat.com>
Thu, 13 Nov 2008 23:38:44 +0000 (10:38 +1100)
committerJames Morris <jmorris@namei.org>
Thu, 13 Nov 2008 23:38:44 +0000 (10:38 +1100)
Wrap access to task credentials so that they can be separated more easily from
the task_struct during the introduction of COW creds.

Change most current->(|e|s|fs)[ug]id to current_(|e|s|fs)[ug]id().

Change some task->e?[ug]id to task_e?[ug]id().  In some places it makes more
sense to use RCU directly rather than a convenient wrapper; these will be
addressed by later patches.

Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: James Morris <jmorris@namei.org>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Reviewed-by: Eric Van Hensbergen <ericvh@gmail.com>
Cc: Ron Minnich <rminnich@sandia.gov>
Cc: Latchesar Ionkov <lucho@ionkov.net>
Cc: v9fs-developer@lists.sourceforge.net
Signed-off-by: James Morris <jmorris@namei.org>
fs/9p/fid.c
fs/9p/vfs_inode.c
fs/9p/vfs_super.c
net/9p/client.c

index 3031e3233dd625302715ff10c3e49ddc4b1aa7f7..a43e4ab7c6c3ebb4fbfed32bd76cc8733989f188 100644 (file)
@@ -120,7 +120,7 @@ struct p9_fid *v9fs_fid_lookup(struct dentry *dentry)
        switch (access) {
        case V9FS_ACCESS_SINGLE:
        case V9FS_ACCESS_USER:
-               uid = current->fsuid;
+               uid = current_fsuid();
                any = 0;
                break;
 
index 8314d3f43b716f41560e4517d42eaade5cfc1459..8fddfe86a0dcd27f7035426b0f27e9e41e53a4a8 100644 (file)
@@ -215,8 +215,8 @@ struct inode *v9fs_get_inode(struct super_block *sb, int mode)
        inode = new_inode(sb);
        if (inode) {
                inode->i_mode = mode;
-               inode->i_uid = current->fsuid;
-               inode->i_gid = current->fsgid;
+               inode->i_uid = current_fsuid();
+               inode->i_gid = current_fsgid();
                inode->i_blocks = 0;
                inode->i_rdev = 0;
                inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
index d6cb1a0ca724d772e2d8bec5093ea621bbe8d864..93212e40221ac10d39757a09cdacffb8fb922edb 100644 (file)
@@ -113,8 +113,8 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
        struct v9fs_session_info *v9ses = NULL;
        struct p9_wstat *st = NULL;
        int mode = S_IRWXUGO | S_ISVTX;
-       uid_t uid = current->fsuid;
-       gid_t gid = current->fsgid;
+       uid_t uid = current_fsuid();
+       gid_t gid = current_fsgid();
        struct p9_fid *fid;
        int retval = 0;
 
index 67717f69412e47c182f34715291ec83c979d6f73..c3fb6f8bfa926b623cc93d407b5aaa832b998c4a 100644 (file)
@@ -628,7 +628,7 @@ static struct p9_fid *p9_fid_create(struct p9_client *clnt)
        memset(&fid->qid, 0, sizeof(struct p9_qid));
        fid->mode = -1;
        fid->rdir_fpos = 0;
-       fid->uid = current->fsuid;
+       fid->uid = current_fsuid();
        fid->clnt = clnt;
        fid->aux = NULL;