diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2013-01-31 05:56:19 -0500 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2013-02-12 06:19:24 -0500 |
commit | 05cb11c17e892f0e131b6c2ba25d63221aafbd11 (patch) | |
tree | e69d457b623ae7e7566191c5cc3323554870a810 /fs/ceph | |
parent | eea553c21fbfa486978c82525ee8256239d4f921 (diff) |
ceph: Translate between uid and gids in cap messages and kuids and kgids
- Make the uid and gid arguments of send_cap_msg() used to compose
ceph_mds_caps messages of type kuid_t and kgid_t.
- Pass inode->i_uid and inode->i_gid in __send_cap to send_cap_msg()
through variables of type kuid_t and kgid_t.
- Modify struct ceph_cap_snap to store uids and gids in types kuid_t
and kgid_t. This allows capturing inode->i_uid and inode->i_gid in
ceph_queue_cap_snap() without loss and pssing them to
__ceph_flush_snaps() where they are removed from struct
ceph_cap_snap and passed to send_cap_msg().
- In handle_cap_grant translate uid and gids in the initial user
namespace stored in struct ceph_mds_cap into kuids and kgids
before setting inode->i_uid and inode->i_gid.
Cc: Sage Weil <sage@inktank.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/caps.c | 14 | ||||
-rw-r--r-- | fs/ceph/super.h | 4 |
2 files changed, 9 insertions, 9 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index a1d9bb30c1bf..39eb4665b122 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
@@ -930,7 +930,7 @@ static int send_cap_msg(struct ceph_mds_session *session, | |||
930 | u64 size, u64 max_size, | 930 | u64 size, u64 max_size, |
931 | struct timespec *mtime, struct timespec *atime, | 931 | struct timespec *mtime, struct timespec *atime, |
932 | u64 time_warp_seq, | 932 | u64 time_warp_seq, |
933 | uid_t uid, gid_t gid, umode_t mode, | 933 | kuid_t uid, kgid_t gid, umode_t mode, |
934 | u64 xattr_version, | 934 | u64 xattr_version, |
935 | struct ceph_buffer *xattrs_buf, | 935 | struct ceph_buffer *xattrs_buf, |
936 | u64 follows) | 936 | u64 follows) |
@@ -974,8 +974,8 @@ static int send_cap_msg(struct ceph_mds_session *session, | |||
974 | ceph_encode_timespec(&fc->atime, atime); | 974 | ceph_encode_timespec(&fc->atime, atime); |
975 | fc->time_warp_seq = cpu_to_le32(time_warp_seq); | 975 | fc->time_warp_seq = cpu_to_le32(time_warp_seq); |
976 | 976 | ||
977 | fc->uid = cpu_to_le32(uid); | 977 | fc->uid = cpu_to_le32(from_kuid(&init_user_ns, uid)); |
978 | fc->gid = cpu_to_le32(gid); | 978 | fc->gid = cpu_to_le32(from_kgid(&init_user_ns, gid)); |
979 | fc->mode = cpu_to_le32(mode); | 979 | fc->mode = cpu_to_le32(mode); |
980 | 980 | ||
981 | fc->xattr_version = cpu_to_le64(xattr_version); | 981 | fc->xattr_version = cpu_to_le64(xattr_version); |
@@ -1081,8 +1081,8 @@ static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap, | |||
1081 | struct timespec mtime, atime; | 1081 | struct timespec mtime, atime; |
1082 | int wake = 0; | 1082 | int wake = 0; |
1083 | umode_t mode; | 1083 | umode_t mode; |
1084 | uid_t uid; | 1084 | kuid_t uid; |
1085 | gid_t gid; | 1085 | kgid_t gid; |
1086 | struct ceph_mds_session *session; | 1086 | struct ceph_mds_session *session; |
1087 | u64 xattr_version = 0; | 1087 | u64 xattr_version = 0; |
1088 | struct ceph_buffer *xattr_blob = NULL; | 1088 | struct ceph_buffer *xattr_blob = NULL; |
@@ -2359,8 +2359,8 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant, | |||
2359 | 2359 | ||
2360 | if ((issued & CEPH_CAP_AUTH_EXCL) == 0) { | 2360 | if ((issued & CEPH_CAP_AUTH_EXCL) == 0) { |
2361 | inode->i_mode = le32_to_cpu(grant->mode); | 2361 | inode->i_mode = le32_to_cpu(grant->mode); |
2362 | inode->i_uid = le32_to_cpu(grant->uid); | 2362 | inode->i_uid = make_kuid(&init_user_ns, le32_to_cpu(grant->uid)); |
2363 | inode->i_gid = 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 | inode->i_uid, inode->i_gid); |
2366 | } | 2366 | } |
diff --git a/fs/ceph/super.h b/fs/ceph/super.h index 66ebe720e40d..f053bbd1886f 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h | |||
@@ -138,8 +138,8 @@ struct ceph_cap_snap { | |||
138 | struct ceph_snap_context *context; | 138 | struct ceph_snap_context *context; |
139 | 139 | ||
140 | umode_t mode; | 140 | umode_t mode; |
141 | uid_t uid; | 141 | kuid_t uid; |
142 | gid_t gid; | 142 | kgid_t gid; |
143 | 143 | ||
144 | struct ceph_buffer *xattr_blob; | 144 | struct ceph_buffer *xattr_blob; |
145 | u64 xattr_version; | 145 | u64 xattr_version; |