]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
MClientRequest: include the full gid list of the caller
authorGreg Farnum <gfarnum@redhat.com>
Sat, 6 Aug 2016 00:20:32 +0000 (17:20 -0700)
committerGreg Farnum <gfarnum@redhat.com>
Wed, 21 Sep 2016 23:33:56 +0000 (16:33 -0700)
Signed-off-by: Greg Farnum <gfarnum@redhat.com>
src/client/Client.cc
src/messages/MClientRequest.h

index 85df5afb6145711211d624ecf0386a8f246b98a2..c3ce432be220827714b7bccf03387094e4e3b2da 100644 (file)
@@ -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;
 }
 
index 1c374591057600c61be3d1ca6f9ea6ad1b41169b..601334272438649ca21e11a63f1affc956faf694 100644 (file)
@@ -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 << '}'
+       << ")";
   }
 
 };