From: John Spray Date: Wed, 8 Oct 2014 09:49:54 +0000 (+0100) Subject: messages: add osd_epoch_barrier to cap msgs X-Git-Tag: v0.91~47^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=68ba7f58389c36fa6192ca2c0556d26dbfb3ba75;p=ceph.git messages: add osd_epoch_barrier to cap msgs 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 --- diff --git a/src/messages/MClientCapRelease.h b/src/messages/MClientCapRelease.h index c1281dee669..37330b70cd1 100644 --- a/src/messages/MClientCapRelease.h +++ b/src/messages/MClientCapRelease.h @@ -19,12 +19,20 @@ class MClientCapRelease : public Message { + static const int HEAD_VERSION = 2; + static const int COMPAT_VERSION = 1; public: struct ceph_mds_cap_release head; vector 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); } }; diff --git a/src/messages/MClientCaps.h b/src/messages/MClientCaps.h index 11c8068df7f..c97a84ec0d7 100644 --- a/src/messages/MClientCaps.h +++ b/src/messages/MClientCaps.h @@ -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); } };