Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

journal: don't hold future lock during assignment #13033

Merged
merged 1 commit into from Jan 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/journal/FutureImpl.cc
Expand Up @@ -39,13 +39,12 @@ void FutureImpl::flush(Context *on_safe) {
m_contexts.push_back(on_safe);
}

prev_future = prepare_flush(&flush_handlers);
prev_future = prepare_flush(&flush_handlers, m_lock);
}
}

// instruct prior futures to flush as well
while (prev_future) {
Mutex::Locker locker(prev_future->m_lock);
prev_future = prev_future->prepare_flush(&flush_handlers);
}

Expand All @@ -62,6 +61,12 @@ void FutureImpl::flush(Context *on_safe) {
}

FutureImplPtr FutureImpl::prepare_flush(FlushHandlers *flush_handlers) {
Mutex::Locker locker(m_lock);
return prepare_flush(flush_handlers, m_lock);
}

FutureImplPtr FutureImpl::prepare_flush(FlushHandlers *flush_handlers,
Mutex &lock) {
assert(m_lock.is_locked());

if (m_flush_state == FLUSH_STATE_NONE) {
Expand Down
1 change: 1 addition & 0 deletions src/journal/FutureImpl.h
Expand Up @@ -113,6 +113,7 @@ class FutureImpl : public RefCountedObject, boost::noncopyable {
Contexts m_contexts;

FutureImplPtr prepare_flush(FlushHandlers *flush_handlers);
FutureImplPtr prepare_flush(FlushHandlers *flush_handlers, Mutex &lock);

void consistent(int r);
void finish_unlock();
Expand Down