Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix mon osd failure message leaks #373

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/mon/OSDMonitor.cc
Expand Up @@ -968,8 +968,10 @@ bool OSDMonitor::prepare_failure(MOSDFailure *m)
<< m->get_orig_source_inst() << "\n";
failure_info_t& fi = failure_info[target_osd];
MOSDFailure *old = fi.add_report(reporter, failed_since, m);
if (old)
if (old) {
mon->no_reply(old);
old->put();
}

return check_failure(now, target_osd, fi);
} else {
Expand All @@ -978,7 +980,14 @@ 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.front()->put();
ls.pop_front();
}
if (fi.reporters.empty()) {
dout(10) << " removing last failure_info for osd." << target_osd << dendl;
failure_info.erase(target_osd);
Expand All @@ -991,6 +1000,7 @@ bool OSDMonitor::prepare_failure(MOSDFailure *m)
dout(10) << " no failure_info for osd." << target_osd << dendl;
}
mon->no_reply(m);
m->put();
}

return false;
Expand Down
4 changes: 4 additions & 0 deletions src/mon/OSDMonitor.h
Expand Up @@ -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
Expand Down