]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: connect to export targets on cap EXPORT
authorSage Weil <sage@newdream.net>
Wed, 1 Dec 2010 17:44:58 +0000 (09:44 -0800)
committerSage Weil <sage@newdream.net>
Wed, 1 Dec 2010 18:20:23 +0000 (10:20 -0800)
Also unconditionally connect on reconnect, even when there aren't any
outstanding requests.

Signed-off-by: Sage Weil <sage@newdream.net>
src/client/Client.cc

index 99ebc2af328a6ccf7601d5fd82ed593cbdee2e99..c9876fc5b1b47f00bb00ba8914107adf065215fb 100644 (file)
@@ -918,20 +918,18 @@ out:
 void Client::connect_mds_targets(int mds)
 {
   //this function shouldn't be called unless we lost a connection
-  assert (mds_sessions.count(mds));
-  MDSSession *s = mds_sessions[mds];
-  if (!s->requests.empty()) {
-    const MDSMap::mds_info_t& info = mdsmap->get_mds_info(mds);
-    for (set<int>::const_iterator q = info.export_targets.begin();
-        q != info.export_targets.end();
-        q++) {
-      if (mds_sessions.count(*q) == 0 && waiting_for_session.count(mds) == 0) {
-       dout(10) << "check_mds_sessions opening mds" << mds
-                << " export target mds" << *q << dendl;
-       messenger->send_message(new MClientSession(CEPH_SESSION_REQUEST_OPEN),
-                               mdsmap->get_inst(*q));
-       waiting_for_session[*q].size();
-      }
+  dout(10) << "connect_mds_targets for mds" << mds << dendl;
+  assert(mds_sessions.count(mds));
+  const MDSMap::mds_info_t& info = mdsmap->get_mds_info(mds);
+  for (set<int>::const_iterator q = info.export_targets.begin();
+       q != info.export_targets.end();
+       q++) {
+    if (mds_sessions.count(*q) == 0 && waiting_for_session.count(mds) == 0) {
+      dout(10) << "check_mds_sessions opening mds" << mds
+              << " export target mds" << *q << dendl;
+      messenger->send_message(new MClientSession(CEPH_SESSION_REQUEST_OPEN),
+                             mdsmap->get_inst(*q));
+      waiting_for_session[*q].size();
     }
   }
 }
@@ -2715,8 +2713,7 @@ void Client::handle_cap_import(Inode *in, MClientCaps *m)
   m->put();
 }
 
-void Client::handle_cap_export(Inode *in, MClientCaps *m,
-                              bool& open_target_sessions)
+void Client::handle_cap_export(Inode *in, MClientCaps *m)
 {
   int mds = m->get_source().num();
   InodeCap *cap = NULL;
@@ -2744,6 +2741,9 @@ void Client::handle_cap_export(Inode *in, MClientCaps *m,
       in->exporting_issued = cap->issued;
       in->exporting_mseq = m->get_mseq();
       in->exporting_mds = mds;
+
+      // open export targets, so we'll get the matching IMPORT
+      connect_mds_targets(mds);
     } else 
       dout(5) << "handle_cap_export ino " << m->get_ino() << " mseq " << m->get_mseq() 
              << " EXPORT from mds" << mds