]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: Monitor: Forward connection features
authorJoao Eduardo Luis <joao.luis@inktank.com>
Mon, 23 Dec 2013 01:26:59 +0000 (17:26 -0800)
committerJoao Eduardo Luis <joao.luis@inktank.com>
Mon, 23 Dec 2013 01:26:59 +0000 (17:26 -0800)
We are relying on connection features to track OSD supported
features.  However, we were not forwarding connection features
when we forwarded a message from a peon to the leader.  That
was breaking the OSD feature tracking.

Fixes: 7051
Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
src/messages/MForward.h
src/mon/Monitor.cc

index 7c88aba8964ae318606796c98edfef20fa69c1cb..45f59b29d6f67d7ec815789479a0e1ad0463e187 100644 (file)
@@ -28,17 +28,26 @@ struct MForward : public Message {
   PaxosServiceMessage *msg;
   entity_inst_t client;
   MonCap client_caps;
-  
-  MForward() : Message(MSG_FORWARD), tid(0), msg(NULL) {}
+  uint64_t conn_features;
+
+  static const int HEAD_VERSION = 2;
+  static const int COMPAT_VERSION = 0;
+
+  MForward() : Message(MSG_FORWARD, HEAD_VERSION, COMPAT_VERSION),
+               tid(0), msg(NULL), conn_features(0) {}
   //the message needs to have caps filled in!
   MForward(uint64_t t, PaxosServiceMessage *m) :
-    Message(MSG_FORWARD), tid(t), msg(m) {
+    Message(MSG_FORWARD, HEAD_VERSION, COMPAT_VERSION),
+    tid(t), msg(m) {
     client = m->get_source_inst();
     client_caps = m->get_session()->caps;
+    conn_features = m->get_connection()->get_features();
   }
   MForward(uint64_t t, PaxosServiceMessage *m, const MonCap& caps) :
-    Message(MSG_FORWARD), tid(t), msg(m), client_caps(caps) {
+    Message(MSG_FORWARD, HEAD_VERSION, COMPAT_VERSION),
+    tid(t), msg(m), client_caps(caps) {
     client = m->get_source_inst();
+    conn_features = m->get_connection()->get_features();
   }
 private:
   ~MForward() {
@@ -51,6 +60,7 @@ public:
     ::encode(client, payload);
     ::encode(client_caps, payload, features);
     encode_message(msg, features, payload);
+    ::encode(conn_features, payload);
   }
 
   void decode_payload() {
@@ -59,12 +69,19 @@ public:
     ::decode(client, p);
     ::decode(client_caps, p);
     msg = (PaxosServiceMessage *)decode_message(NULL, p);
+    if (header.version >= 2) {
+      ::decode(conn_features, p);
+    } else {
+      conn_features = 0;
+    }
+
   }
 
   const char *get_type_name() const { return "forward"; }
   void print(ostream& o) const {
     if (msg)
-      o << "forward(" << *msg << " caps " << client_caps << ") to leader";
+      o << "forward(" << *msg << " caps " << client_caps
+        << " conn_features " << conn_features << ") to leader";
     else o << "forward(??? ) to leader";
   }
 };
index c0d7b6f349d856f89c00c306319e2fdf0b445261..fc3a66e4d0fc642aaae709bfa56eca0bf1924b40 100644 (file)
@@ -2419,6 +2419,7 @@ void Monitor::handle_forward(MForward *m)
     c->set_priv(s);
     c->set_peer_addr(m->client.addr);
     c->set_peer_type(m->client.name.type());
+    c->set_features(m->conn_features);
 
     s->caps = m->client_caps;
     dout(10) << " caps are " << s->caps << dendl;