This will cause discard threads to wake up each other
if bdev_async_discard_threads >= 2.
Fixes: https://tracker.ceph.com/issues/67835
Signed-off-by: Yite Gu <yitegu0@gmail.com>
(cherry picked from commit
cec2e4550fe520fa60445678934c04ba605913be)
dout(10) << __func__ << dendl;
std::unique_lock l(discard_lock);
while (!discard_queued.empty() || (discard_running > 0)) {
+ need_notify = true;
discard_cond.wait(l);
}
}
if (thr->stop)
break;
dout(20) << __func__ << " sleep" << dendl;
- discard_cond.notify_all(); // for the thread trying to drain...
+ if (need_notify) {
+ discard_cond.notify_all(); // for the thread trying to drain...
+ need_notify = false;
+ }
discard_cond.wait(l);
dout(20) << __func__ << " wake" << dendl;
} else {
aio_callback_t discard_callback;
void *discard_callback_priv;
bool aio_stop;
+ bool need_notify = false;
ceph::mutex discard_lock = ceph::make_mutex("KernelDevice::discard_lock");
ceph::condition_variable discard_cond;