mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Aristeu Rozanski <arozansk@redhat.com>
To: aris@redhat.com, "Eric W. Biederman" <ebiederm@xmission.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 4/5] userns: Convert AFS to use kuid and kgid where appropriate
Date: Wed, 11 Jul 2012 15:01:21 -0400	[thread overview]
Message-ID: <1342033282-24933-5-git-send-email-arozansk@redhat.com> (raw)
In-Reply-To: <1342033282-24933-1-git-send-email-arozansk@redhat.com>

From: Aristeu Rozanski <aris@redhat.com>

Signed-off-by: Aristeu Rozanski <aris@redhat.com>
---
 fs/afs/fsclient.c |    8 ++++----
 fs/afs/inode.c    |    8 ++++----
 init/Kconfig      |    1 -
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/fs/afs/fsclient.c b/fs/afs/fsclient.c
index b960ff0..daac5b3 100644
--- a/fs/afs/fsclient.c
+++ b/fs/afs/fsclient.c
@@ -87,8 +87,8 @@ static void xdr_decode_AFSFetchStatus(const __be32 **_bp,
 		if (changed && !test_bit(AFS_VNODE_UNSET, &vnode->flags)) {
 			_debug("vnode changed");
 			i_size_write(&vnode->vfs_inode, size);
-			vnode->vfs_inode.i_uid = status->owner;
-			vnode->vfs_inode.i_gid = status->group;
+			i_uid_write(&vnode->vfs_inode, status->owner);
+			i_gid_write(&vnode->vfs_inode, status->group);
 			vnode->vfs_inode.i_generation = vnode->fid.unique;
 			set_nlink(&vnode->vfs_inode, status->nlink);
 
@@ -181,12 +181,12 @@ static void xdr_encode_AFS_StoreStatus(__be32 **_bp, struct iattr *attr)
 
 	if (attr->ia_valid & ATTR_UID) {
 		mask |= AFS_SET_OWNER;
-		owner = attr->ia_uid;
+		owner = from_kuid_munged(current_user_ns(), attr->ia_uid);
 	}
 
 	if (attr->ia_valid & ATTR_GID) {
 		mask |= AFS_SET_GROUP;
-		group = attr->ia_gid;
+		group = from_kgid_munged(current_user_ns(), attr->ia_gid);
 	}
 
 	if (attr->ia_valid & ATTR_MODE) {
diff --git a/fs/afs/inode.c b/fs/afs/inode.c
index d890ae3..1e6f1c8 100644
--- a/fs/afs/inode.c
+++ b/fs/afs/inode.c
@@ -68,8 +68,8 @@ static int afs_inode_map_status(struct afs_vnode *vnode, struct key *key)
 #endif
 
 	set_nlink(inode, vnode->status.nlink);
-	inode->i_uid		= vnode->status.owner;
-	inode->i_gid		= 0;
+	i_uid_write(inode, vnode->status.owner);
+	inode->i_gid = GLOBAL_ROOT_GID;
 	inode->i_size		= vnode->status.size;
 	inode->i_ctime.tv_sec	= vnode->status.mtime_server;
 	inode->i_ctime.tv_nsec	= 0;
@@ -175,8 +175,8 @@ struct inode *afs_iget_autocell(struct inode *dir, const char *dev_name,
 	inode->i_mode		= S_IFDIR | S_IRUGO | S_IXUGO;
 	inode->i_op		= &afs_autocell_inode_operations;
 	set_nlink(inode, 2);
-	inode->i_uid		= 0;
-	inode->i_gid		= 0;
+	inode->i_uid = GLOBAL_ROOT_UID;
+	inode->i_gid = GLOBAL_ROOT_GID;
 	inode->i_ctime.tv_sec	= get_seconds();
 	inode->i_ctime.tv_nsec	= 0;
 	inode->i_atime		= inode->i_mtime = inode->i_ctime;
diff --git a/init/Kconfig b/init/Kconfig
index 52a3736..2ab57ca 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -909,7 +909,6 @@ config UIDGID_CONVERTED
 	depends on DEVTMPFS = n
 	depends on XENFS = n
 
-	depends on AFS_FS = n
 	depends on AUTOFS4_FS = n
 	depends on BEFS_FS = n
 	depends on BFS_FS = n
-- 
1.7.1


  parent reply	other threads:[~2012-07-11 19:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-11 19:01 [PATCH 0/5] userns: convert some filesystems to kuid/kgid Aristeu Rozanski
2012-07-11 19:01 ` [PATCH 1/5] userns: Convert 9p to use kuid and kgid where appropriate Aristeu Rozanski
2012-07-11 19:01 ` [PATCH 2/5] userns: Convert ADFS " Aristeu Rozanski
2012-07-11 19:01 ` [PATCH 3/5] userns: Convert AFFS " Aristeu Rozanski
2012-07-11 19:01 ` Aristeu Rozanski [this message]
2012-07-11 19:01 ` [PATCH 5/5] userns: Convert autofs4 " Aristeu Rozanski
2012-07-25 16:11 ` [PATCH 0/5] userns: convert some filesystems to kuid/kgid Aristeu Rozanski
2012-07-25 23:14   ` Eric W. Biederman
2012-07-26 17:13     ` Aristeu Rozanski
2012-07-26 17:24       ` Eric W. Biederman
2012-07-26 17:28         ` Aristeu Rozanski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1342033282-24933-5-git-send-email-arozansk@redhat.com \
    --to=arozansk@redhat.com \
    --cc=aris@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®