]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
filestore: fix op queue quiesce during commit
authorSage Weil <sage@newdream.net>
Thu, 9 Feb 2012 19:23:10 +0000 (11:23 -0800)
committerSage Weil <sage@newdream.net>
Fri, 10 Feb 2012 00:20:58 +0000 (16:20 -0800)
When I added the ordering constraint fix back in 259c509a I got the
check backwards.  We want to wait if we are blocked OR we are not in the
front of the line (i.e., proceed if we are not blocked AND first in line).

Fixes: #2046
Signed-off-by: Sage Weil <sage@newdream.net>
src/os/JournalingObjectStore.cc

index 66356d9a6e55c303c01abe7e481cfb3816c92dc2..884e5c469706c81d4d7979596c314cfe5367a7fd 100644 (file)
@@ -122,7 +122,8 @@ uint64_t JournalingObjectStore::_op_apply_start(uint64_t op)
     Cond cond;
     ops_apply_blocked.push_back(&cond);
     dout(10) << "op_apply_start " << op << " blocked (getting in back of line)" << dendl;
-    while (blocked && ops_apply_blocked.front() != &cond)
+    // sleep until we are not blocked AND we are at the front of line
+    while (blocked || ops_apply_blocked.front() != &cond)
       cond.Wait(journal_lock);
     dout(10) << "op_apply_start " << op << " woke (at front of line)" << dendl;
     ops_apply_blocked.pop_front();
@@ -130,19 +131,17 @@ uint64_t JournalingObjectStore::_op_apply_start(uint64_t op)
       dout(10) << "op_apply_start " << op << "  ...and kicking next in line" << dendl;
       ops_apply_blocked.front()->Signal();
     }
-  } else {
-    dout(10) << "op_apply_start " << op << dendl;
   }
-
+  dout(10) << "op_apply_start " << op << " open_ops " << open_ops << " -> " << (open_ops+1) << dendl;
+  assert(!blocked);
   open_ops++;
-
   return op;
 }
 
 void JournalingObjectStore::op_apply_finish(uint64_t op) 
 {
-  dout(10) << "op_apply_finish " << op << dendl;
   journal_lock.Lock();
+  dout(10) << "op_apply_finish " << op << " open_ops " << open_ops << " -> " << (open_ops-1) << dendl;
   if (--open_ops == 0)
     cond.Signal();
 
@@ -213,7 +212,9 @@ bool JournalingObjectStore::commit_start()
     dout(10) << "commit_start blocked, waiting for " << open_ops << " open ops" << dendl;
     cond.Wait(journal_lock);
   }
-  
+  dout(10) << "commit_start blocked, all open_ops have completed" << dendl;
+  assert(open_ops == 0);
+
   if (applied_seq == committed_seq && !force_commit) {
     dout(10) << "commit_start nothing to do" << dendl;
     blocked = false;