From 5f53346dc276c69aa12dfd0eccdac880242b4e24 Mon Sep 17 00:00:00 2001 From: Igor Fedotov Date: Wed, 24 May 2017 06:54:42 -0700 Subject: [PATCH] os/bluestore: fix false assertion Signed-off-by: Igor Fedotov --- src/os/bluestore/BlockDevice.h | 7 ++++++- src/os/bluestore/KernelDevice.cc | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/os/bluestore/BlockDevice.h b/src/os/bluestore/BlockDevice.h index eb783a89269..f2b48f05a8b 100644 --- a/src/os/bluestore/BlockDevice.h +++ b/src/os/bluestore/BlockDevice.h @@ -63,10 +63,15 @@ public: 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); + assert(num_running >= 0); } else { --num_running; } diff --git a/src/os/bluestore/KernelDevice.cc b/src/os/bluestore/KernelDevice.cc index 0ee44c13a7c..a87573f6279 100644 --- a/src/os/bluestore/KernelDevice.cc +++ b/src/os/bluestore/KernelDevice.cc @@ -380,7 +380,7 @@ void KernelDevice::_aio_thread() aio_callback(aio_callback_priv, ioc->priv); } } else { - ioc->try_aio_wake(); + ioc->try_aio_wake(); } } } -- 2.47.3