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: v12.2.12~101^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bea4edb7a1d37d57b6646d5d0a4b14b345805a2f;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 (cherry picked from commit dbbde306484276251cbd7a7b7a6fde0093f98ba2) Conflicts: src/os/bluestore/BlockDevice.h : Resolved in try_aio_wake --- diff --git a/src/os/bluestore/BlockDevice.h b/src/os/bluestore/BlockDevice.h index 280e650cb36..bd74f81306d 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);