]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/Journaler: avoid executing on_safe contexts prematurely
authorYan, Zheng <zyan@redhat.com>
Tue, 23 May 2017 13:46:54 +0000 (21:46 +0800)
committerYan, Zheng <zyan@redhat.com>
Wed, 24 May 2017 03:36:40 +0000 (11:36 +0800)
Journaler::_do_flush() can skip flushing some data when prezered
journal space isn't enough. Before updating Journaler::next_safe_pos,
we need to check if Journaler::_do_flush() has flushed enough data.

Fixes: http://tracker.ceph.com/issues/20055
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/osdc/Journaler.cc

index 5949ff3b4016cd4282279996f15719cd7281bdae..bfecac212c3b33bff0e7f16f7fdb938107ef8819 100644 (file)
@@ -568,8 +568,11 @@ uint64_t Journaler::append_entry(bufferlist& bl)
     ldout(cct, 10) << " flushing completed object(s) (su " << su << " wro "
                   << write_obj << " flo " << flush_obj << ")" << dendl;
     _do_flush(write_buf.length() - write_off);
-    if (write_off) {
-      // current entry isn't being flushed, set next_safe_pos to the end of previous entry
+
+    // if _do_flush() skips flushing some data, it does not update next_safe_pos.
+    if (write_buf.length() > 0 &&
+       write_buf.length() <= wrote) { // the unflushed data are within this entry
+      // set next_safe_pos to end of previous entry
       next_safe_pos = write_pos - wrote;
     }
   }