]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: be pedantic about kv_stop locking
authorSage Weil <sage@redhat.com>
Mon, 28 Nov 2016 19:23:36 +0000 (14:23 -0500)
committerSage Weil <sage@redhat.com>
Mon, 28 Nov 2016 19:29:13 +0000 (14:29 -0500)
Makes coverity happy.

CID 1395346 (#1 of 1): Data race condition (MISSING_LOCK)
1. missing_lock: Accessing this->kv_stop without holding lock BlueStore.kv_lock. Elsewhere, "BlueStore.kv_stop" is accessed with BlueStore.kv_lock held 1 out of 2 times (1 of these accesses strongly imply that it is necessary).

Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueStore.h

index 2676afe6f70d5e738a6df3476f67a15f5689ee96..07dc17ae9c193608e3ca935ed1dc13e98a74b393 100644 (file)
@@ -1677,7 +1677,10 @@ private:
       kv_cond.notify_all();
     }
     kv_sync_thread.join();
-    kv_stop = false;
+    {
+      std::lock_guard<std::mutex> l(kv_lock);
+      kv_stop = false;
+    }
   }
 
   bluestore_wal_op_t *_get_wal_op(TransContext *txc, OnodeRef o);