mirror of
https://github.com/ceph/ceph
synced 2025-01-01 00:22:25 +00:00
MClientRequest: include the full gid list of the caller
Signed-off-by: Greg Farnum <gfarnum@redhat.com>
This commit is contained in:
parent
07d6fc0309
commit
d291e664ae
@ -2169,6 +2169,9 @@ MClientRequest* Client::build_client_request(MetaRequest *request)
|
||||
req->set_data(request->data);
|
||||
req->set_retry_attempt(request->retry_attempt++);
|
||||
req->head.num_fwd = request->num_fwd;
|
||||
const gid_t *_gids;
|
||||
int gid_count = request->perms.get_gids(&_gids);
|
||||
req->set_gid_list(gid_count, _gids);
|
||||
return req;
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@
|
||||
// metadata ops.
|
||||
|
||||
class MClientRequest : public Message {
|
||||
static const int HEAD_VERSION = 3;
|
||||
static const int HEAD_VERSION = 4;
|
||||
static const int COMPAT_VERSION = 1;
|
||||
|
||||
public:
|
||||
@ -75,6 +75,7 @@ public:
|
||||
|
||||
// path arguments
|
||||
filepath path, path2;
|
||||
vector<uint64_t> gid_list;
|
||||
|
||||
|
||||
|
||||
@ -136,6 +137,12 @@ public:
|
||||
void set_string2(const char *s) { path2.set_path(s, 0); }
|
||||
void set_caller_uid(unsigned u) { head.caller_uid = u; }
|
||||
void set_caller_gid(unsigned g) { head.caller_gid = g; }
|
||||
void set_gid_list(int count, const gid_t *gids) {
|
||||
gid_list.reserve(count);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
gid_list.push_back(gids[i]);
|
||||
}
|
||||
}
|
||||
void set_dentry_wanted() {
|
||||
head.flags = head.flags | CEPH_MDS_FLAG_WANT_DENTRY;
|
||||
}
|
||||
@ -150,6 +157,7 @@ public:
|
||||
int get_op() const { return head.op; }
|
||||
unsigned get_caller_uid() const { return head.caller_uid; }
|
||||
unsigned get_caller_gid() const { return head.caller_gid; }
|
||||
const vector<uint64_t>& get_caller_gid_list() const { return gid_list; }
|
||||
|
||||
const string& get_path() const { return path.get_path(); }
|
||||
const filepath& get_filepath() const { return path; }
|
||||
@ -166,6 +174,8 @@ public:
|
||||
::decode_nohead(head.num_releases, releases, p);
|
||||
if (header.version >= 2)
|
||||
::decode(stamp, p);
|
||||
if (header.version >= 4) // epoch 3 was for a ceph_mds_request_args change
|
||||
::decode(gid_list, p);
|
||||
}
|
||||
|
||||
void encode_payload(uint64_t features) {
|
||||
@ -175,6 +185,7 @@ public:
|
||||
::encode(path2, payload);
|
||||
::encode_nohead(releases, payload);
|
||||
::encode(stamp, payload);
|
||||
::encode(gid_list, payload);
|
||||
}
|
||||
|
||||
const char *get_type_name() const { return "creq"; }
|
||||
@ -218,7 +229,13 @@ public:
|
||||
out << " RETRY=" << (int)head.num_retry;
|
||||
if (get_flags() & CEPH_MDS_FLAG_REPLAY)
|
||||
out << " REPLAY";
|
||||
out << ")";
|
||||
out << " caller_uid=" << head.caller_uid
|
||||
<< ", caller_gid=" << head.caller_gid
|
||||
<< '{';
|
||||
for (auto i = gid_list.begin(); i != gid_list.end(); ++i)
|
||||
out << *i << ',';
|
||||
out << '}'
|
||||
<< ")";
|
||||
}
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user