X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ceph%2Fsrc%2Fos%2Fbluestore%2FBlockDevice.h;h=f2b48f05a8bd7c3a8b746b52e2aaa1b889dc78f9;hb=31f18b776d001752a193a7cec8bb49033c1a904c;hp=4448b2ef6defaf506d89969f96fed0327d07dee2;hpb=7c673caec407dd16107e56e4b51a6d00f021315c;p=ceph.git diff --git a/ceph/src/os/bluestore/BlockDevice.h b/ceph/src/os/bluestore/BlockDevice.h index 4448b2ef6..f2b48f05a 100644 --- a/ceph/src/os/bluestore/BlockDevice.h +++ b/ceph/src/os/bluestore/BlockDevice.h @@ -29,6 +29,11 @@ /// track in-flight io struct IOContext { +private: + std::mutex lock; + std::condition_variable cond; + +public: CephContext* cct; void *priv; #ifdef HAVE_SPDK @@ -36,8 +41,6 @@ struct IOContext { void *nvme_task_last = nullptr; #endif - std::mutex lock; - std::condition_variable cond; std::list pending_aios; ///< not yet submitted std::list running_aios; ///< submitting or submitted @@ -58,11 +61,20 @@ struct IOContext { void aio_wait(); - void aio_wake() { - std::lock_guard l(lock); - cond.notify_all(); - --num_running; - assert(num_running == 0); + void try_aio_wake() { + 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); + } else { + --num_running; + } } };