diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2013-01-31 07:05:39 -0500 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2013-02-12 06:19:27 -0500 |
commit | bd2bae6a66df9261a39e47291b0a6b00cd0831e0 (patch) | |
tree | b8aa3234df77e0d147b35138631e2e09268e5b61 /fs | |
parent | ff3d0046625c1b37df37beb8477135d44dae2823 (diff) |
ceph: Convert kuids and kgids before printing them.
Before printing kuid and kgids values convert them into
the initial user namespace.
Cc: Sage Weil <sage@inktank.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ceph/caps.c | 3 | ||||
-rw-r--r-- | fs/ceph/inode.c | 9 |
2 files changed, 8 insertions, 4 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 39eb4665b122..ae2be696eb5b 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
@@ -2362,7 +2362,8 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant, | |||
2362 | inode->i_uid = make_kuid(&init_user_ns, le32_to_cpu(grant->uid)); | 2362 | inode->i_uid = make_kuid(&init_user_ns, le32_to_cpu(grant->uid)); |
2363 | inode->i_gid = make_kgid(&init_user_ns, le32_to_cpu(grant->gid)); | 2363 | inode->i_gid = make_kgid(&init_user_ns, le32_to_cpu(grant->gid)); |
2364 | dout("%p mode 0%o uid.gid %d.%d\n", inode, inode->i_mode, | 2364 | dout("%p mode 0%o uid.gid %d.%d\n", inode, inode->i_mode, |
2365 | inode->i_uid, inode->i_gid); | 2365 | from_kuid(&init_user_ns, inode->i_uid), |
2366 | from_kgid(&init_user_ns, inode->i_gid)); | ||
2366 | } | 2367 | } |
2367 | 2368 | ||
2368 | if ((issued & CEPH_CAP_LINK_EXCL) == 0) | 2369 | if ((issued & CEPH_CAP_LINK_EXCL) == 0) |
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 40e0787022e9..d45895f4a04d 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c | |||
@@ -615,7 +615,8 @@ static int fill_inode(struct inode *inode, | |||
615 | inode->i_uid = make_kuid(&init_user_ns, le32_to_cpu(info->uid)); | 615 | inode->i_uid = make_kuid(&init_user_ns, le32_to_cpu(info->uid)); |
616 | inode->i_gid = make_kgid(&init_user_ns, le32_to_cpu(info->gid)); | 616 | inode->i_gid = make_kgid(&init_user_ns, le32_to_cpu(info->gid)); |
617 | dout("%p mode 0%o uid.gid %d.%d\n", inode, inode->i_mode, | 617 | dout("%p mode 0%o uid.gid %d.%d\n", inode, inode->i_mode, |
618 | inode->i_uid, inode->i_gid); | 618 | from_kuid(&init_user_ns, inode->i_uid), |
619 | from_kgid(&init_user_ns, inode->i_gid)); | ||
619 | } | 620 | } |
620 | 621 | ||
621 | if ((issued & CEPH_CAP_LINK_EXCL) == 0) | 622 | if ((issued & CEPH_CAP_LINK_EXCL) == 0) |
@@ -1565,7 +1566,8 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr) | |||
1565 | 1566 | ||
1566 | if (ia_valid & ATTR_UID) { | 1567 | if (ia_valid & ATTR_UID) { |
1567 | dout("setattr %p uid %d -> %d\n", inode, | 1568 | dout("setattr %p uid %d -> %d\n", inode, |
1568 | inode->i_uid, attr->ia_uid); | 1569 | from_kuid(&init_user_ns, inode->i_uid), |
1570 | from_kuid(&init_user_ns, attr->ia_uid)); | ||
1569 | if (issued & CEPH_CAP_AUTH_EXCL) { | 1571 | if (issued & CEPH_CAP_AUTH_EXCL) { |
1570 | inode->i_uid = attr->ia_uid; | 1572 | inode->i_uid = attr->ia_uid; |
1571 | dirtied |= CEPH_CAP_AUTH_EXCL; | 1573 | dirtied |= CEPH_CAP_AUTH_EXCL; |
@@ -1579,7 +1581,8 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr) | |||
1579 | } | 1581 | } |
1580 | if (ia_valid & ATTR_GID) { | 1582 | if (ia_valid & ATTR_GID) { |
1581 | dout("setattr %p gid %d -> %d\n", inode, | 1583 | dout("setattr %p gid %d -> %d\n", inode, |
1582 | inode->i_gid, attr->ia_gid); | 1584 | from_kgid(&init_user_ns, inode->i_gid), |
1585 | from_kgid(&init_user_ns, attr->ia_gid)); | ||
1583 | if (issued & CEPH_CAP_AUTH_EXCL) { | 1586 | if (issued & CEPH_CAP_AUTH_EXCL) { |
1584 | inode->i_gid = attr->ia_gid; | 1587 | inode->i_gid = attr->ia_gid; |
1585 | dirtied |= CEPH_CAP_AUTH_EXCL; | 1588 | dirtied |= CEPH_CAP_AUTH_EXCL; |