From: Sage Weil Date: Wed, 12 Apr 2017 18:19:46 +0000 (-0400) Subject: os/bluestore: fix narrow osr->flush() race X-Git-Tag: v12.0.2~68^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F14489%2Fhead;p=ceph.git os/bluestore: fix narrow osr->flush() race Signed-off-by: Sage Weil --- diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 8c7732fa8378..535c745ae53c 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -1655,10 +1655,13 @@ public: void flush() override { std::unique_lock 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; }