{
if (flushing_count.load()) {
ldout(c->store->cct, 20) << __func__ << " cnt:" << flushing_count << dendl;
+ waiting_count++;
std::unique_lock l(flush_lock);
while (flushing_count.load()) {
flush_cond.wait(l);
}
+ waiting_count--;
}
ldout(c->store->cct, 20) << __func__ << " done" << dendl;
}
for (auto& o : *ls) {
dout(20) << __func__ << " onode " << o << " had " << o->flushing_count
<< dendl;
- if (--o->flushing_count == 0) {
+ if (--o->flushing_count == 0 && o->waiting_count.load()) {
std::lock_guard l(o->flush_lock);
o->flush_cond.notify_all();
}
// track txc's that have not been committed to kv store (and whose
// effects cannot be read via the kvdb read methods)
std::atomic<int> flushing_count = {0};
+ std::atomic<int> waiting_count = {0};
/// protect flush_txns
ceph::mutex flush_lock = ceph::make_mutex("BlueStore::Onode::flush_lock");
ceph::condition_variable flush_cond; ///< wait here for uncommitted txns