]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: make sync_fs() flush dirty data in objectcacher 6388/head
authorYan, Zheng <zyan@redhat.com>
Wed, 28 Oct 2015 10:00:14 +0000 (18:00 +0800)
committerYan, Zheng <zyan@redhat.com>
Thu, 24 Dec 2015 07:54:42 +0000 (15:54 +0800)
Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/client/Client.cc

index 01250124db6fe35a53824958c1881ef01edf5a9d..f6da89b8c358b659d142fdabe7a54446362bacb0 100644 (file)
@@ -8640,6 +8640,15 @@ int Client::_sync_fs()
 {
   ldout(cct, 10) << "_sync_fs" << dendl;
 
+  // flush file data
+  Mutex lock("Client::_fsync::lock");
+  Cond cond;
+  bool flush_done = false;
+  if (cct->_conf->client_oc)
+    objectcacher->flush_all(new C_SafeCond(&lock, &cond, &flush_done));
+  else
+    flush_done = true;
+
   // flush caps
   flush_caps();
   ceph_tid_t flush_tid = last_flush_tid;
@@ -8649,8 +8658,15 @@ int Client::_sync_fs()
 
   wait_sync_caps(flush_tid);
 
-  // flush file data
-  // FIXME
+  if (!flush_done) {
+    client_lock.Unlock();
+    lock.Lock();
+    ldout(cct, 15) << "waiting on data to flush" << dendl;
+    while (!flush_done)
+      cond.Wait(lock);
+    lock.Unlock();
+    client_lock.Lock();
+  }
 
   return 0;
 }