]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/messages/MClientRequest.h
update ceph source to reef 18.2.1
[ceph.git] / ceph / src / messages / MClientRequest.h
index d8cec31531a9640e567361eac571307da9f62fa8..f63657d2e2537f573d5b716a6a70c4702c6cc03b 100644 (file)
@@ -38,6 +38,7 @@
 #include "include/filepath.h"
 #include "mds/mdstypes.h"
 #include "include/ceph_features.h"
+#include "mds/cephfs_features.h"
 #include "messages/MMDSOp.h"
 
 #include <sys/types.h>
@@ -73,7 +74,7 @@ private:
 public:
   mutable struct ceph_mds_request_head head; /* XXX HACK! */
   utime_t stamp;
-  bool peer_old_version = false;
+  feature_bitset_t mds_features;
 
   struct Release {
     mutable ceph_mds_request_release item;
@@ -113,12 +114,16 @@ protected:
   MClientRequest()
     : MMDSOp(CEPH_MSG_CLIENT_REQUEST, HEAD_VERSION, COMPAT_VERSION) {
     memset(&head, 0, sizeof(head));
+    head.owner_uid = -1;
+    head.owner_gid = -1;
   }
-  MClientRequest(int op, bool over=true)
+  MClientRequest(int op, feature_bitset_t features = 0)
     : MMDSOp(CEPH_MSG_CLIENT_REQUEST, HEAD_VERSION, COMPAT_VERSION) {
     memset(&head, 0, sizeof(head));
     head.op = op;
-    peer_old_version = over;
+    mds_features = features;
+    head.owner_uid = -1;
+    head.owner_gid = -1;
   }
   ~MClientRequest() final {}
 
@@ -201,6 +206,8 @@ 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; }
+  unsigned get_owner_uid() const { return head.owner_uid; }
+  unsigned get_owner_gid() const { return head.owner_gid; }
   const std::vector<uint64_t>& get_caller_gid_list() const { return gid_list; }
 
   const std::string& get_path() const { return path.get_path(); }
@@ -227,6 +234,12 @@ public:
       copy_from_legacy_head(&head, &old_mds_head);
       head.version = 0;
 
+      head.ext_num_retry = head.num_retry;
+      head.ext_num_fwd = head.num_fwd;
+
+      head.owner_uid = head.caller_uid;
+      head.owner_gid = head.caller_gid;
+
       /* Can't set the btime from legacy struct */
       if (head.op == CEPH_MDS_OP_SETATTR) {
        int localmask = head.args.setattr.mask;
@@ -262,14 +275,16 @@ public:
      * client will just copy the 'head' memory and isn't
      * that smart to skip them.
      */
-    if (peer_old_version) {
+    if (!mds_features.test(CEPHFS_FEATURE_32BITS_RETRY_FWD)) {
       head.version = 1;
+    } else if (!mds_features.test(CEPHFS_FEATURE_HAS_OWNER_UIDGID)) {
+      head.version = 2;
     } else {
       head.version = CEPH_MDS_REQUEST_HEAD_VERSION;
     }
 
     if (features & CEPH_FEATURE_FS_BTIME) {
-      encode(head, payload, peer_old_version);
+      encode(head, payload);
     } else {
       struct ceph_mds_request_head_legacy old_mds_head;
 
@@ -292,6 +307,10 @@ public:
     out << "client_request(" << get_orig_source()
        << ":" << get_tid()
        << " " << ceph_mds_op_name(get_op());
+    if (IS_CEPH_MDS_OP_NEWINODE(head.op)) {
+      out << " owner_uid=" << head.owner_uid
+         << ", owner_gid=" << head.owner_gid;
+    }
     if (head.op == CEPH_MDS_OP_GETATTR)
       out << " " << ccap_string(head.args.getattr.mask);
     if (head.op == CEPH_MDS_OP_SETATTR) {