From 47013c289e6ad6638b0f77152dafbc9f4723c032 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 29 Dec 2011 09:00:46 -0800 Subject: [PATCH] osd: get fsid from monmap, not osdmap We may not have a valid OSDMap in all of these cases (notably, during boot). Always take the fsid from the monmap, which will be valid after we've authenticated. This fixes messages like 2011-12-29 08:53:44.530830 7ff3595e2700 mon.a@0(leader).pg v5 handle_statfs on fsid 00000000-0000-0000-0000-000000000000 != f8a6383d-5fbe-4f65-907e-f8d09e1d540d on the monitor from MPGStats messages with a bad fsid right after osd boot. Signed-off-by: Sage Weil --- src/mon/PGMonitor.cc | 2 +- src/osd/OSD.cc | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mon/PGMonitor.cc b/src/mon/PGMonitor.cc index d4f31f1c81821..77d14185ded58 100644 --- a/src/mon/PGMonitor.cc +++ b/src/mon/PGMonitor.cc @@ -427,7 +427,7 @@ bool PGMonitor::prepare_pg_stats(MPGStats *stats) int from = stats->get_orig_source().num(); if (stats->fsid != mon->monmap->fsid) { - dout(0) << "handle_statfs on fsid " << stats->fsid << " != " << mon->monmap->fsid << dendl; + dout(0) << "prepare_pg_stats on fsid " << stats->fsid << " != " << mon->monmap->fsid << dendl; stats->put(); return false; } diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 467816fe9ef4c..f80eefc67ae40 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -1419,7 +1419,7 @@ void OSD::_add_heartbeat_source(int p, map& old_from, mapget_peer_addr() << dendl; heartbeat_from_stamp[p] = ceph_clock_now(g_ceph_context); - MOSDPing *m = new MOSDPing(osdmap->get_fsid(), 0, heartbeat_epoch, + MOSDPing *m = new MOSDPing(monc->get_fsid(), 0, heartbeat_epoch, MOSDPing::START_HEARTBEAT); hbin_messenger->send_message(m, con); } @@ -1486,14 +1486,14 @@ void OSD::update_heartbeat_peers() dout(10) << "update_heartbeat_peers: telling old peer osd." << p->first << " " << old_con[p->first]->get_peer_addr() << " they are down" << dendl; - hbin_messenger->send_message(new MOSDPing(osdmap->get_fsid(), heartbeat_epoch, + hbin_messenger->send_message(new MOSDPing(monc->get_fsid(), heartbeat_epoch, heartbeat_epoch, MOSDPing::YOU_DIED), con); hbin_messenger->mark_disposable(con); hbin_messenger->mark_down_on_empty(con); } else { // tell them to stop sending heartbeats - hbin_messenger->send_message(new MOSDPing(osdmap->get_fsid(), 0, heartbeat_epoch, + hbin_messenger->send_message(new MOSDPing(monc->get_fsid(), 0, heartbeat_epoch, MOSDPing::STOP_HEARTBEAT), con); } if (!osdmap->is_up(p->first)) { @@ -1709,7 +1709,7 @@ void OSD::heartbeat() i++) { int peer = i->first; dout(30) << "heartbeat allocating ping for osd." << peer << dendl; - Message *m = new MOSDPing(osdmap->get_fsid(), + Message *m = new MOSDPing(monc->get_fsid(), map_locked ? osdmap->get_epoch():0, i->second, MOSDPing::HEARTBEAT); m->set_priority(CEPH_MSG_PRIO_HIGH); @@ -2130,7 +2130,7 @@ void OSD::send_pg_stats(const utime_t &now) utime_t had_for(now); had_for -= had_map_since; - MPGStats *m = new MPGStats(osdmap->get_fsid(), osdmap->get_epoch(), had_for); + MPGStats *m = new MPGStats(monc->get_fsid(), osdmap->get_epoch(), had_for); m->set_tid(++pg_stat_tid); m->osd_stat = cur_stat; -- 2.39.5