]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: fix narrow osr->flush() race 14489/head
authorSage Weil <sage@redhat.com>
Wed, 12 Apr 2017 18:19:46 +0000 (14:19 -0400)
committerSage Weil <sage@redhat.com>
Wed, 12 Apr 2017 18:19:46 +0000 (14:19 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueStore.h

index 8c7732fa8378a8d6c9a6e328b8cdfcc453554e8b..535c745ae53cfc995d12d052a6028fb3fb373f61 100644 (file)
@@ -1655,10 +1655,13 @@ public:
     void flush() override {
       std::unique_lock<std::mutex> l(qlock);
       while (true) {
+       // set flag before the check because the condition
+       // may become true outside qlock, and we need to make
+       // sure those threads see waiters and signal qcond.
+       ++kv_submitted_waiters;
        if (_is_all_kv_submitted()) {
          return;
        }
-       ++kv_submitted_waiters;
        qcond.wait(l);
        --kv_submitted_waiters;
       }