summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2012-12-11 17:15:56 -0800
committerSage Weil <sage@inktank.com>2012-12-11 17:15:56 -0800
commitcaea0cbf9f63d74506d69a596dd3f78097d68da5 (patch)
tree912db1e2b52171b44a5aae95e75f33db84bca525
parent29307d3b32e523da7f25a6c3bc904749790b1e18 (diff)
downloadceph-caea0cbf9f63d74506d69a596dd3f78097d68da5.tar.gz
os/JournalingObjectStore: un-break op quiescing during journal replay
Commit d9dce4e9273adb4279519d65a0d8bfdfecb5c516 broke journal replay because the commit thread may try to do a commit, and the ops are not being applied via the normal work queue. Add back in a simpler form of the old op quiescing (simpler because there is a single thread doing the replay). Signed-off-by: Sage Weil <sage@inktank.com> Reviewed-by: Samuel Just <sam.just@inktank.com>
-rw-r--r--src/os/JournalingObjectStore.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/os/JournalingObjectStore.cc b/src/os/JournalingObjectStore.cc
index b91b6dc207c..971fd15b824 100644
--- a/src/os/JournalingObjectStore.cc
+++ b/src/os/JournalingObjectStore.cc
@@ -109,6 +109,11 @@ int JournalingObjectStore::journal_replay(uint64_t fs_op_seq)
uint64_t JournalingObjectStore::ApplyManager::op_apply_start(uint64_t op)
{
Mutex::Locker l(apply_lock);
+ while (blocked) {
+ // note: this only happens during journal replay
+ dout(10) << "op_apply_start blocked, waiting" << dendl;
+ blocked_cond.Wait(apply_lock);
+ }
dout(10) << "op_apply_start " << op << " open_ops " << open_ops << " -> " << (open_ops+1) << dendl;
assert(!blocked);
assert(op > committed_seq);
@@ -126,6 +131,11 @@ void JournalingObjectStore::ApplyManager::op_apply_finish(uint64_t op)
--open_ops;
assert(open_ops >= 0);
+ // signal a blocked commit_start (only needed during journal replay)
+ if (blocked) {
+ blocked_cond.Signal();
+ }
+
// there can be multiple applies in flight; track the max value we
// note. note that we can't _read_ this value and learn anything
// meaningful unless/until we've quiesced all in-flight applies.
@@ -173,6 +183,10 @@ bool JournalingObjectStore::ApplyManager::commit_start()
<< ", open_ops " << open_ops
<< dendl;
blocked = true;
+ while (open_ops > 0) {
+ dout(10) << "commit_start waiting for " << open_ops << " open ops to drain" << dendl;
+ blocked_cond.Wait(apply_lock);
+ }
assert(open_ops == 0);
dout(10) << "commit_start blocked, all open_ops have completed" << dendl;
{
@@ -204,6 +218,7 @@ void JournalingObjectStore::ApplyManager::commit_started()
// allow new ops. (underlying fs should now be committing all prior ops)
dout(10) << "commit_started committing " << committing_seq << ", unblocking" << dendl;
blocked = false;
+ blocked_cond.Signal();
}
void JournalingObjectStore::ApplyManager::commit_finish()