From: "Eric W. Biederman" <ebiederm@xmission.com>
To: <linux-fsdevel@vger.kernel.org>
Cc: Linux Containers <containers@lists.linux-foundation.org>,
<linux-kernel@vger.kernel.org>,
"Serge E. Hallyn" <serge@hallyn.com>,
"Eric W. Biederman" <ebiederm@xmission.com>,
David Howells <dhowells@redhat.com>
Subject: [PATCH RFC 02/12] userns: Convert afs to use kuid/kgid where appropriate
Date: Tue, 20 Nov 2012 04:43:30 -0800 [thread overview]
Message-ID: <1353415420-5457-2-git-send-email-ebiederm@xmission.com> (raw)
In-Reply-To: <1353415420-5457-1-git-send-email-ebiederm@xmission.com>
From: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: David Howells <dhowells@redhat.com>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
fs/afs/afs.h | 4 ++--
fs/afs/fsclient.c | 14 ++++++++++----
fs/afs/inode.c | 6 +++---
init/Kconfig | 1 -
4 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/fs/afs/afs.h b/fs/afs/afs.h
index c548aa3..ba7ac7b 100644
--- a/fs/afs/afs.h
+++ b/fs/afs/afs.h
@@ -119,8 +119,8 @@ struct afs_file_status {
u64 size; /* file size */
afs_dataversion_t data_version; /* current data version */
u32 author; /* author ID */
- u32 owner; /* owner ID */
- u32 group; /* group ID */
+ kuid_t owner; /* owner ID */
+ kgid_t group; /* group ID */
afs_access_t caller_access; /* access rights for authenticated caller */
afs_access_t anon_access; /* access rights for unauthenticated caller */
umode_t mode; /* UNIX mode */
diff --git a/fs/afs/fsclient.c b/fs/afs/fsclient.c
index b960ff0..eecbf4b 100644
--- a/fs/afs/fsclient.c
+++ b/fs/afs/fsclient.c
@@ -42,6 +42,8 @@ static void xdr_decode_AFSFetchStatus(const __be32 **_bp,
umode_t mode;
u64 data_version, size;
u32 changed = 0; /* becomes non-zero if ctime-type changes seen */
+ u32 owner;
+ u32 group;
#define EXTRACT(DST) \
do { \
@@ -56,7 +58,9 @@ static void xdr_decode_AFSFetchStatus(const __be32 **_bp,
size = ntohl(*bp++);
data_version = ntohl(*bp++);
EXTRACT(status->author);
- EXTRACT(status->owner);
+ owner = from_kuid(&init_user_ns, status->owner);
+ EXTRACT(owner);
+ status->owner = make_kuid(&init_user_ns, owner);
EXTRACT(status->caller_access); /* call ticket dependent */
EXTRACT(status->anon_access);
EXTRACT(status->mode);
@@ -65,7 +69,9 @@ static void xdr_decode_AFSFetchStatus(const __be32 **_bp,
bp++; /* seg size */
status->mtime_client = ntohl(*bp++);
status->mtime_server = ntohl(*bp++);
- EXTRACT(status->group);
+ group = from_kgid(&init_user_ns, status->group);
+ EXTRACT(group);
+ status->group = make_kgid(&init_user_ns, group);
bp++; /* sync counter */
data_version |= (u64) ntohl(*bp++) << 32;
EXTRACT(status->lock_count);
@@ -181,12 +187,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(&init_user_ns, attr->ia_uid);
}
if (attr->ia_valid & ATTR_GID) {
mask |= AFS_SET_GROUP;
- group = attr->ia_gid;
+ group = from_kgid(&init_user_ns, attr->ia_gid);
}
if (attr->ia_valid & ATTR_MODE) {
diff --git a/fs/afs/inode.c b/fs/afs/inode.c
index 95cffd3..789bc25 100644
--- a/fs/afs/inode.c
+++ b/fs/afs/inode.c
@@ -69,7 +69,7 @@ static int afs_inode_map_status(struct afs_vnode *vnode, struct key *key)
set_nlink(inode, vnode->status.nlink);
inode->i_uid = vnode->status.owner;
- inode->i_gid = 0;
+ 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 35c1b89..dfa391d 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -999,7 +999,6 @@ config UIDGID_CONVERTED
default y
# Filesystems
- depends on AFS_FS = n
depends on CEPH_FS = n
depends on CIFS = n
depends on CODA_FS = n
--
1.7.5.4
next prev parent reply other threads:[~2012-11-20 12:44 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-20 12:42 [PATCH RFC 0/12] Final userns conversions Eric W. Biederman
2012-11-20 12:43 ` [PATCH RFC 01/12] userns: Support 9p interacting with multiple user namespaces Eric W. Biederman
2012-11-20 12:43 ` Eric W. Biederman [this message]
2012-11-20 12:43 ` [PATCH RFC 03/12] userns: Convert ceph to use kuid/kgid where appropriate Eric W. Biederman
2012-11-20 16:48 ` Sage Weil
2012-11-20 17:15 ` Eric W. Biederman
2012-11-20 12:43 ` [PATCH RFC 04/12] userns: Convert cifs " Eric W. Biederman
[not found] ` <CAH2r5mt91Av7w6GQUPNu2A9EGRNbPGGAhMO=EobOMi5Cn8gh5g@mail.gmail.com>
2012-11-20 17:22 ` Eric W. Biederman
2012-11-25 12:47 ` Jeff Layton
2012-11-20 12:43 ` [PATCH RFC 05/12] userns: Convert coda's " Eric W. Biederman
2012-11-20 12:43 ` [PATCH RFC 06/12] userns: Convert gfs2 " Eric W. Biederman
2012-11-22 9:47 ` Steven Whitehouse
2012-11-20 12:43 ` [PATCH RFC 07/12] userns: Convert ncpfs to use kuid and kgid " Eric W. Biederman
2012-11-20 12:43 ` [PATCH RFC 08/12] userns: Convert nfs and nfsd to use kuid/kgid " Eric W. Biederman
2012-11-20 12:43 ` [PATCH RFC 09/12] userns: Convert ocfs2 to use kuid and kgid " Eric W. Biederman
2012-11-21 19:51 ` Joel Becker
2013-02-13 17:12 ` Eric W. Biederman
2012-11-21 19:59 ` Joel Becker
2012-11-20 12:43 ` [PATCH RFC 10/12] userns: Convert xfs to use kuid/kgid/kprojid " Eric W. Biederman
2012-11-20 23:55 ` Dave Chinner
2012-11-21 19:52 ` Joel Becker
2013-02-13 18:13 ` Eric W. Biederman
2013-02-14 2:19 ` Dave Chinner
2013-02-18 1:25 ` Eric W. Biederman
2013-02-19 3:30 ` Dave Chinner
2012-11-20 12:43 ` [PATCH RFC 11/12] userns: Now that everything has been converted remove the unnecessary infrastructure Eric W. Biederman
2012-11-20 12:43 ` [PATCH RFC 12/12] userns: Remove the EXPERMINTAL kconfig tag Eric W. Biederman
2012-11-21 0:09 ` [PATCH RFC 0/12] Final userns conversions Dave Chinner
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=1353415420-5457-2-git-send-email-ebiederm@xmission.com \
--to=ebiederm@xmission.com \
--cc=containers@lists.linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=serge@hallyn.com \
/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®