replicate the behavior of `Cond::SloppySignal()` to avoid crash like
ceph version Development (no_version) octopus (dev)
1: <ceph::__ceph_assert_fail(char const*, char const, int, char const)+0x1e0> at /home/jenkins/workspace/ceph-master36/build/bin/ceph-osd
2: <ceph::__ceph_assert_fail(ceph::assert_data const&)+0x2f> at /home/jenkins/workspace/ceph-master36/build/bin/ceph-osd
3: <ceph::condition_variable_debug::notify_all(bool)+0x59> at /home/jenkins/workspace/ceph-master36/build/bin/ceph-osd
4: <FileJournal::check_for_full(unsigned long, long, long)+0x4e2> at /home/jenkins/workspace/ceph-master36/build/bin/ceph-osd
5: <FileJournal::prepare_single_write(FileJournal::write_item&, ceph::buffer::v14_2_0::list&, long&, unsigned long&, long&)+0x71> at /home/jenkins/workspace/ceph-master36/build/bin/ceph-osd
6: <FileJournal::prepare_multi_write(ceph::buffer::v14_2_0::list&, unsigned long&, ceph::buffer::v14_2_0::list&)+0x19d> at /home/jenkins/workspace/ceph-master36/build/bin/ceph-osd
7: <FileJournal::write_thread_entry(void)+0x561> at /home/jenkins/workspace/ceph-master36/build/bin/ceph-osd
8: <FileJournal::Writer::entry(void)+0x19> at /home/jenkins/workspace/ceph-master36/build/bin/ceph-osd
9: <Thread::entry_wrapper(void)+0x84> at /home/jenkins/workspace/ceph-master36/build/bin/ceph-osd
10: <Thread::_entry_func(void*)+0x15> at /home/jenkins/workspace/ceph-master36/build/bin/ceph-osd
Signed-off-by: Kefu Chai <kchai@redhat.com>
void condition_variable_debug::notify_all(bool sloppy)
{
- // make sure signaler is holding the waiter's lock.
- ceph_assert(waiter_mutex == NULL ||
- waiter_mutex->is_locked());
+ if (!sloppy) {
+ // make sure signaler is holding the waiter's lock.
+ ceph_assert(waiter_mutex == NULL ||
+ waiter_mutex->is_locked());
+ }
if (int r = pthread_cond_broadcast(&cond); r != 0 && !sloppy) {
throw std::system_error(r, std::generic_category());
}