diff options
author | Sage Weil <sage@inktank.com> | 2013-06-23 08:53:09 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-06-23 08:53:09 -0700 |
commit | ad12b0d61b8c4565ee8a5f352689b9121da2bcd2 (patch) | |
tree | b0be440314319be0d6b6cd8eca0390548799b947 | |
parent | 1aca370ed0caf060c38479036ef32a90702fb565 (diff) | |
download | ceph-ad12b0d61b8c4565ee8a5f352689b9121da2bcd2.tar.gz |
mon: fix leak of MOSDFailure messages
We need to discard/cancel/free the failure report messages before we
cancel a report out. Assert in the dtor to ensure we didn't forget.
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
-rw-r--r-- | src/mon/OSDMonitor.cc | 6 | ||||
-rw-r--r-- | src/mon/OSDMonitor.h | 4 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index cf0e45d9a65..9db57b9d93d 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -978,7 +978,13 @@ bool OSDMonitor::prepare_failure(MOSDFailure *m) << m->get_orig_source_inst() << "\n"; if (failure_info.count(target_osd)) { failure_info_t& fi = failure_info[target_osd]; + list<MOSDFailure*> ls; + fi.take_report_messages(ls); fi.cancel_report(reporter); + while (!ls.empty()) { + mon->no_reply(ls.front()); + ls.pop_front(); + } if (fi.reporters.empty()) { dout(10) << " removing last failure_info for osd." << target_osd << dendl; failure_info.erase(target_osd); diff --git a/src/mon/OSDMonitor.h b/src/mon/OSDMonitor.h index ef5ba77462b..5af3d0cb057 100644 --- a/src/mon/OSDMonitor.h +++ b/src/mon/OSDMonitor.h @@ -45,6 +45,10 @@ struct failure_reporter_t { failure_reporter_t() : num_reports(0), msg(NULL) {} failure_reporter_t(utime_t s) : num_reports(1), failed_since(s), msg(NULL) {} + ~failure_reporter_t() { + // caller should have taken this message before removing the entry. + assert(!msg); + } }; /// information about all failure reports for one osd |