]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
journaler: fix flush completion when nothing to flush
authorSage Weil <sage@newdream.net>
Mon, 25 Apr 2011 17:01:31 +0000 (10:01 -0700)
committerSage Weil <sage@newdream.net>
Mon, 25 Apr 2011 17:01:31 +0000 (10:01 -0700)
Signed-off-by: Sage Weil <sage@newdream.net>
src/osdc/Journaler.cc

index a43b25c6178fda549264f326373f04162435260c..d9d2f0b9aeb3d2fe761f1a8c0ddca1bd84676955 100644 (file)
@@ -530,14 +530,15 @@ void Journaler::wait_for_flush(Context *onsafe)
 void Journaler::flush(Context *onsafe)
 {
   assert(!readonly);
-  wait_for_flush(onsafe);
-  if (write_pos == safe_pos)
-    return;
 
   if (write_pos == flush_pos) {
     assert(write_buf.length() == 0);
     dout(10) << "flush nothing to flush, write pointers at "
             << write_pos << "/" << flush_pos << "/" << safe_pos << dendl;
+    if (onsafe) {
+      onsafe->finish(0);
+      delete onsafe;
+    }
   } else {
     if (1) {
       // maybe buffer
@@ -556,6 +557,7 @@ void Journaler::flush(Context *onsafe)
       // always flush
       _do_flush();
     }
+    wait_for_flush(onsafe);
   }
 
   // write head?