mirror of
https://github.com/ceph/ceph
synced 2025-01-02 17:12:31 +00:00
Merge pull request #12938 from LiumxNL/fix-process-osd-failure
mon/OSDMonitor: fix process osd failure Reviewed-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
commit
1e8ca9bb90
@ -1776,13 +1776,12 @@ bool OSDMonitor::prepare_failure(MonOpRequestRef op)
|
|||||||
assert(osdmap.is_up(target_osd));
|
assert(osdmap.is_up(target_osd));
|
||||||
assert(osdmap.get_addr(target_osd) == m->get_target().addr);
|
assert(osdmap.get_addr(target_osd) == m->get_target().addr);
|
||||||
|
|
||||||
// calculate failure time
|
|
||||||
utime_t now = ceph_clock_now();
|
|
||||||
utime_t failed_since =
|
|
||||||
m->get_recv_stamp() -
|
|
||||||
utime_t(m->failed_for ? m->failed_for : g_conf->osd_heartbeat_grace, 0);
|
|
||||||
|
|
||||||
if (m->if_osd_failed()) {
|
if (m->if_osd_failed()) {
|
||||||
|
// calculate failure time
|
||||||
|
utime_t now = ceph_clock_now();
|
||||||
|
utime_t failed_since =
|
||||||
|
m->get_recv_stamp() - utime_t(m->failed_for, 0);
|
||||||
|
|
||||||
// add a report
|
// add a report
|
||||||
if (m->is_immediate()) {
|
if (m->is_immediate()) {
|
||||||
mon->clog->debug() << m->get_target() << " reported immediately failed by "
|
mon->clog->debug() << m->get_target() << " reported immediately failed by "
|
||||||
@ -1806,13 +1805,9 @@ bool OSDMonitor::prepare_failure(MonOpRequestRef op)
|
|||||||
<< m->get_orig_source_inst() << "\n";
|
<< m->get_orig_source_inst() << "\n";
|
||||||
if (failure_info.count(target_osd)) {
|
if (failure_info.count(target_osd)) {
|
||||||
failure_info_t& fi = failure_info[target_osd];
|
failure_info_t& fi = failure_info[target_osd];
|
||||||
list<MonOpRequestRef> ls;
|
MonOpRequestRef report_op = fi.cancel_report(reporter);
|
||||||
fi.take_report_messages(ls);
|
if (report_op) {
|
||||||
fi.cancel_report(reporter);
|
mon->no_reply(report_op);
|
||||||
while (!ls.empty()) {
|
|
||||||
if (ls.front())
|
|
||||||
mon->no_reply(ls.front());
|
|
||||||
ls.pop_front();
|
|
||||||
}
|
}
|
||||||
if (fi.reporters.empty()) {
|
if (fi.reporters.empty()) {
|
||||||
dout(10) << " removing last failure_info for osd." << target_osd
|
dout(10) << " removing last failure_info for osd." << target_osd
|
||||||
|
@ -99,13 +99,13 @@ struct failure_info_t {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cancel_report(int who) {
|
MonOpRequestRef cancel_report(int who) {
|
||||||
map<int, failure_reporter_t>::iterator p = reporters.find(who);
|
map<int, failure_reporter_t>::iterator p = reporters.find(who);
|
||||||
if (p == reporters.end())
|
if (p == reporters.end())
|
||||||
return;
|
return MonOpRequestRef();
|
||||||
|
MonOpRequestRef ret = p->second.op;
|
||||||
reporters.erase(p);
|
reporters.erase(p);
|
||||||
if (reporters.empty())
|
return ret;
|
||||||
max_failed_since = utime_t();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user