From: linbing Date: Fri, 21 Dec 2018 00:22:30 +0000 (+0800) Subject: os/bluestore: fixup access a destroy cond cause deadlock or undefine X-Git-Tag: v14.1.0~511^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F25659%2Fhead;p=ceph.git os/bluestore: fixup access a destroy cond cause deadlock or undefine behavior. Fixes: https://tracker.ceph.com/issues/37733 Signed-off-by: linbing --- diff --git a/src/os/bluestore/BlockDevice.h b/src/os/bluestore/BlockDevice.h index 5faa26073baf..ad60ab32cd44 100644 --- a/src/os/bluestore/BlockDevice.h +++ b/src/os/bluestore/BlockDevice.h @@ -95,13 +95,14 @@ public: void try_aio_wake() { assert(num_running >= 1); + + std::lock_guard l(lock); if (num_running.fetch_sub(1) == 1) { // we might have some pending IOs submitted after the check // as there is no lock protection for aio_submit. // Hence we might have false conditional trigger. // aio_wait has to handle that hence do not care here. - std::lock_guard l(lock); cond.notify_all(); } }