]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: handle REJECT session messages from MDS
authorJohn Spray <john.spray@redhat.com>
Tue, 13 Oct 2015 13:44:21 +0000 (14:44 +0100)
committerJohn Spray <john.spray@redhat.com>
Tue, 5 Jan 2016 14:05:04 +0000 (14:05 +0000)
So that we can go quiet and not hammer an MDS with
session open messages if it keeps kicking us out.

Signed-off-by: John Spray <john.spray@redhat.com>
src/client/Client.cc
src/client/Client.h

index 0a6a97452b55a2669fdc1d41a6856a9a6fc14fdc..9d4caf9f9973d25702779d69b0395cc71a2ffade 100644 (file)
@@ -1886,6 +1886,21 @@ MetaSession *Client::_open_mds_session(mds_rank_t mds)
   session->con = messenger->get_connection(session->inst);
   session->state = MetaSession::STATE_OPENING;
   mds_sessions[mds] = session;
+
+  // Maybe skip sending a request to open if this MDS daemon
+  // has previously sent us a REJECT.
+  if (rejected_by_mds.count(mds)) {
+    if (rejected_by_mds[mds] == session->inst) {
+      ldout(cct, 4) << "_open_mds_session mds." << mds << " skipping "
+                       "because we were rejected" << dendl;
+      return session;
+    } else {
+      ldout(cct, 4) << "_open_mds_session mds." << mds << " old inst "
+                       "rejected us, trying with new inst" << dendl;
+      rejected_by_mds.erase(mds);
+    }
+  }
+
   MClientSession *m = new MClientSession(CEPH_SESSION_REQUEST_OPEN);
   m->client_meta = metadata;
   session->con->send_message(m);
@@ -1962,6 +1977,12 @@ void Client::handle_client_session(MClientSession *m)
     force_session_readonly(session);
     break;
 
+  case CEPH_SESSION_REJECT:
+    rejected_by_mds[session->mds_num] = session->inst;
+    _closed_mds_session(session);
+
+    break;
+
   default:
     assert(0);
   }
index 8b317000bee5a60ca4873ef15a1f86517c2cadf4..5f364289992ea1d6917873253f11cb0514997836 100644 (file)
@@ -349,6 +349,12 @@ protected:
   bool   mounted;
   bool   unmounting;
 
+  // When an MDS has sent us a REJECT, remember that and don't
+  // contact it again.  Remember which inst rejected us, so that
+  // when we talk to another inst with the same rank we can
+  // try again.
+  std::map<mds_rank_t, entity_inst_t> rejected_by_mds;
+
   int local_osd;
   epoch_t local_osd_epoch;