]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
log: protect m_stop with lock
authorSage Weil <sage@inktank.com>
Sat, 25 Aug 2012 03:02:14 +0000 (20:02 -0700)
committerSage Weil <sage@inktank.com>
Fri, 31 Aug 2012 20:11:35 +0000 (13:11 -0700)
CID 716965: Data race condition (MISSING_LOCK)
At (2): Accessing "this->m_stop" ("_ZN4ceph3log3LogE.m_stop") requires the "_ZN4ceph3log3LogE.m_queue_mutex" lock.

This isn't strictly needed since we assume only one thread will call this
method and start a thead, but it makes coverity happy.

Signed-off-by: Sage Weil <sage@inktank.com>
src/log/Log.cc

index f418a8ac6af042f8a6203424b69b796595f4fc01..32d8be79c4557dd2a11cd661f4be13280782b583 100644 (file)
@@ -288,7 +288,9 @@ void Log::dump_recent()
 void Log::start()
 {
   assert(!is_started());
+  pthread_mutex_lock(&m_queue_mutex);
   m_stop = false;
+  pthread_mutex_unlock(&m_queue_mutex);
   create();
 }