Commit cb4276cc authored by Sage Weil's avatar Sage Weil

ceph: fix uid/gid on resent mds requests

MDS requests can be rebuilt and resent in non-process context, but were
filling in uid/gid from current_fsuid/gid.  Put that information in the
request struct on request setup.

This fixes incorrect (and root) uid/gid getting set for requests that
are forwarded between MDSs, usually due to metadata migrations.
Signed-off-by: default avatarSage Weil <sage@newdream.net>
parent cd045cb4
...@@ -529,6 +529,9 @@ static void __register_request(struct ceph_mds_client *mdsc, ...@@ -529,6 +529,9 @@ static void __register_request(struct ceph_mds_client *mdsc,
ceph_mdsc_get_request(req); ceph_mdsc_get_request(req);
__insert_request(mdsc, req); __insert_request(mdsc, req);
req->r_uid = current_fsuid();
req->r_gid = current_fsgid();
if (dir) { if (dir) {
struct ceph_inode_info *ci = ceph_inode(dir); struct ceph_inode_info *ci = ceph_inode(dir);
...@@ -1588,8 +1591,8 @@ static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc, ...@@ -1588,8 +1591,8 @@ static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc,
head->mdsmap_epoch = cpu_to_le32(mdsc->mdsmap->m_epoch); head->mdsmap_epoch = cpu_to_le32(mdsc->mdsmap->m_epoch);
head->op = cpu_to_le32(req->r_op); head->op = cpu_to_le32(req->r_op);
head->caller_uid = cpu_to_le32(current_fsuid()); head->caller_uid = cpu_to_le32(req->r_uid);
head->caller_gid = cpu_to_le32(current_fsgid()); head->caller_gid = cpu_to_le32(req->r_gid);
head->args = req->r_args; head->args = req->r_args;
ceph_encode_filepath(&p, end, ino1, path1); ceph_encode_filepath(&p, end, ino1, path1);
......
...@@ -170,6 +170,8 @@ struct ceph_mds_request { ...@@ -170,6 +170,8 @@ struct ceph_mds_request {
union ceph_mds_request_args r_args; union ceph_mds_request_args r_args;
int r_fmode; /* file mode, if expecting cap */ int r_fmode; /* file mode, if expecting cap */
uid_t r_uid;
gid_t r_gid;
/* for choosing which mds to send this request to */ /* for choosing which mds to send this request to */
int r_direct_mode; int r_direct_mode;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment