Merge pull request #13033 from dillaman/wip-18618

journal: don't hold future lock during assignment

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
This commit is contained in:
Mykola Golub 2017-01-22 14:52:32 +02:00 committed by GitHub
commit fce69f6348
2 changed files with 8 additions and 2 deletions

View File

@ -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);
}
@ -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) {

View File

@ -113,6 +113,7 @@ private:
Contexts m_contexts;
FutureImplPtr prepare_flush(FlushHandlers *flush_handlers);
FutureImplPtr prepare_flush(FlushHandlers *flush_handlers, Mutex &lock);
void consistent(int r);
void finish_unlock();