]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
messages: add osd_epoch_barrier to cap msgs
authorJohn Spray <john.spray@redhat.com>
Wed, 8 Oct 2014 09:49:54 +0000 (10:49 +0100)
committerJohn Spray <john.spray@redhat.com>
Tue, 16 Dec 2014 20:51:49 +0000 (20:51 +0000)
Extension to client-server protocol to allow clients
to release capabilities conditional on the receiver
having a particular OSD map, and the MDS to issue
caps conditional on the user having a particular
OSD map.

Signed-off-by: John Spray <john.spray@redhat.com>
src/messages/MClientCapRelease.h
src/messages/MClientCaps.h

index c1281dee6699ac3bec615ca24da1e7b44bcf3d93..37330b70cd1c60fb20a461c18da0e0c8375748ce 100644 (file)
 
 
 class MClientCapRelease : public Message {
+  static const int HEAD_VERSION = 2;
+  static const int COMPAT_VERSION = 1;
  public:
   struct ceph_mds_cap_release head;
   vector<ceph_mds_cap_item> caps;
 
+  // The message receiver must wait for this OSD epoch
+  // before actioning this cap release.
+  epoch_t osd_epoch_barrier;
+
   MClientCapRelease() : 
-    Message(CEPH_MSG_CLIENT_CAPRELEASE) {
+    Message(CEPH_MSG_CLIENT_CAPRELEASE, HEAD_VERSION, COMPAT_VERSION),
+    osd_epoch_barrier(0)
+  {
     memset(&head, 0, sizeof(head));
   }
 private:
@@ -40,11 +48,15 @@ public:
     bufferlist::iterator p = payload.begin();
     ::decode(head, p);
     ::decode_nohead(head.num, caps, p);
+    if (header.version >= 2) {
+      ::decode(osd_epoch_barrier, p);
+    }
   }
   void encode_payload(uint64_t features) {
     head.num = caps.size();
     ::encode(head, payload);
     ::encode_nohead(caps, payload);
+    ::encode(osd_epoch_barrier, payload);
   }
 };
 
index 11c8068df7f7c4cb91f991e6ffbffe348e63682f..c97a84ec0d7c15c53300585b1ca9637be76ce4ab 100644 (file)
@@ -20,8 +20,7 @@
 
 
 class MClientCaps : public Message {
-
-  static const int HEAD_VERSION = 4;   // added flock metadata, inline data
+  static const int HEAD_VERSION = 5;
   static const int COMPAT_VERSION = 1;
 
  public:
@@ -33,6 +32,9 @@ class MClientCaps : public Message {
   version_t  inline_version;
   bufferlist inline_data;
 
+  // Receivers may not use their new caps until they have this OSD map
+  epoch_t osd_epoch_barrier;
+
   int      get_caps() { return head.caps; }
   int      get_wanted() { return head.wanted; }
   int      get_dirty() { return head.dirty; }
@@ -85,7 +87,8 @@ class MClientCaps : public Message {
   }
 
   MClientCaps()
-    : Message(CEPH_MSG_CLIENT_CAPS, HEAD_VERSION, COMPAT_VERSION) {
+    : Message(CEPH_MSG_CLIENT_CAPS, HEAD_VERSION, COMPAT_VERSION),
+      osd_epoch_barrier(0) {
     inline_version = 0;
   }
   MClientCaps(int op,
@@ -96,8 +99,10 @@ class MClientCaps : public Message {
              int caps,
              int wanted,
              int dirty,
-             int mseq)
-    : Message(CEPH_MSG_CLIENT_CAPS, HEAD_VERSION, COMPAT_VERSION) {
+             int mseq,
+              epoch_t oeb)
+    : Message(CEPH_MSG_CLIENT_CAPS, HEAD_VERSION, COMPAT_VERSION),
+      osd_epoch_barrier(oeb) {
     memset(&head, 0, sizeof(head));
     head.op = op;
     head.ino = ino;
@@ -113,8 +118,9 @@ class MClientCaps : public Message {
   }
   MClientCaps(int op,
              inodeno_t ino, inodeno_t realm,
-             uint64_t id, int mseq)
-    : Message(CEPH_MSG_CLIENT_CAPS, HEAD_VERSION) {
+             uint64_t id, int mseq, epoch_t oeb)
+    : Message(CEPH_MSG_CLIENT_CAPS, HEAD_VERSION),
+      osd_epoch_barrier(oeb){
     memset(&head, 0, sizeof(head));
     head.op = op;
     head.ino = ino;
@@ -182,6 +188,10 @@ public:
     } else {
       inline_version = CEPH_INLINE_NONE;
     }
+
+    if (header.version >= 5) {
+      ::decode(osd_epoch_barrier, p);
+    }
   }
   void encode_payload(uint64_t features) {
     head.snap_trace_len = snapbl.length();
@@ -219,6 +229,8 @@ public:
       header.version = 3;
       return;
     }
+
+    ::encode(osd_epoch_barrier, payload);
   }
 };