From bea4edb7a1d37d57b6646d5d0a4b14b345805a2f Mon Sep 17 00:00:00 2001 From: linbing Date: Fri, 21 Dec 2018 08:22:30 +0800 Subject: [PATCH] os/bluestore: fixup access a destroy cond cause deadlock or undefine behavior. Fixes: https://tracker.ceph.com/issues/37733 Signed-off-by: linbing (cherry picked from commit dbbde306484276251cbd7a7b7a6fde0093f98ba2) Conflicts: src/os/bluestore/BlockDevice.h : Resolved in try_aio_wake --- src/os/bluestore/BlockDevice.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/os/bluestore/BlockDevice.h b/src/os/bluestore/BlockDevice.h index 280e650cb365..bd74f81306d5 100644 --- a/src/os/bluestore/BlockDevice.h +++ b/src/os/bluestore/BlockDevice.h @@ -64,13 +64,13 @@ public: void aio_wait(); void try_aio_wake() { + std::lock_guard l(lock); if (num_running == 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(); --num_running; assert(num_running >= 0); -- 2.47.3