]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Client: signal MDS to flush log when doing a syncfs
authordongdong <tdd21151186@gmail.com>
Wed, 7 Jun 2017 05:41:27 +0000 (13:41 +0800)
committerdongdong <tdd21151186@gmail.com>
Mon, 19 Jun 2017 13:47:40 +0000 (21:47 +0800)
Fixes: http://tracker.ceph.com/issues/20129
Signed-off-by: dongdong tao <tdd21151186@gmail.com>
src/client/Client.cc
src/client/Client.h
src/include/ceph_fs.h
src/mds/Server.cc

index 0a55e73977e3bb866d02daf0730e3285c5bd78ba..93d348c026b378d9a487bd8516ab6f97b65290fb 100644 (file)
@@ -5788,6 +5788,24 @@ void Client::_close_sessions()
   }
 }
 
+void Client::flush_mdlog_sync()
+{
+
+  for (map<mds_rank_t,MetaSession*>::iterator p = mds_sessions.begin();
+       p != mds_sessions.end();
+       ++p) {
+    MetaSession *s = p->second;
+    flush_mdlog(s);
+  }
+}
+
+void Client::flush_mdlog(MetaSession *session)
+{
+  MClientSession *m = new MClientSession(CEPH_SESSION_REQUEST_FLUSH_MDLOG);
+  session->con->send_message(m);
+}
+
+
 void Client::unmount()
 {
   Mutex::Locker lock(client_lock);
@@ -5799,6 +5817,7 @@ void Client::unmount()
 
   while (!mds_requests.empty()) {
     ldout(cct, 10) << "waiting on " << mds_requests.size() << " requests" << dendl;
+    flush_mdlog_sync();
     mount_cond.Wait(client_lock);
   }
 
index da06729e8176dd21a35092be4ff37574398984ed..b6369a29363e13da06ff54751d53a15f8a935dd1 100644 (file)
@@ -724,7 +724,11 @@ protected:
 
   bool use_faked_inos() { return _use_faked_inos; }
   vinodeno_t map_faked_ino(ino_t ino);
-
+  //notify the mds to flush the mdlog
+  void flush_mdlog_sync();
+  void flush_mdlog(MetaSession *session);
+  
   // ----------------------
   // fs ops.
 private:
index 726ee69d62f21602592083a36ca7a36625fbb25f..4188bff8b03fdcf7062c1d974b2c712147cb93ef 100644 (file)
@@ -305,7 +305,8 @@ enum {
        CEPH_SESSION_FORCE_RO,
     // A response to REQUEST_OPEN indicating that the client should
     // permanently desist from contacting the MDS
-       CEPH_SESSION_REJECT
+       CEPH_SESSION_REJECT,
+        CEPH_SESSION_REQUEST_FLUSH_MDLOG
 };
 
 extern const char *ceph_session_op_name(int op);
index 43ea584be1b1d760f7e4032a0ab491070ce076d4..7dab254119281977d0514f97529fed745dc4442e 100644 (file)
@@ -455,6 +455,10 @@ void Server::handle_client_session(MClientSession *m)
     finish_flush_session(session, m->get_seq());
     break;
 
+  case CEPH_SESSION_REQUEST_FLUSH_MDLOG:
+    mdlog->flush();
+    break;
+
   default:
     ceph_abort();
   }