From cf763fdb6a93190c8d2a6399b7a38c1016008f3f Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 28 Oct 2008 13:49:32 -0700 Subject: [PATCH] osd: include fsid in MPGStats --- src/messages/MPGStats.h | 4 ++++ src/mon/PGMonitor.cc | 8 ++++++++ src/osd/OSD.cc | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/messages/MPGStats.h b/src/messages/MPGStats.h index 31d721f31b08c..4cabe6b803fa6 100644 --- a/src/messages/MPGStats.h +++ b/src/messages/MPGStats.h @@ -19,10 +19,12 @@ class MPGStats : public Message { public: + ceph_fsid fsid; map pg_stat; osd_stat_t osd_stat; MPGStats() : Message(MSG_PGSTATS) {} + MPGStats(ceph_fsid& f) : Message(MSG_PGSTATS), fsid(f) {} const char *get_type_name() { return "pg_stats"; } void print(ostream& out) { @@ -30,11 +32,13 @@ public: } void encode_payload() { + ::encode(fsid, payload); ::encode(osd_stat, payload); ::encode(pg_stat, payload); } void decode_payload() { bufferlist::iterator p = payload.begin(); + ::decode(fsid, p); ::decode(osd_stat, p); ::decode(pg_stat, p); } diff --git a/src/mon/PGMonitor.cc b/src/mon/PGMonitor.cc index e911f3ce00895..5ecde061e72e9 100644 --- a/src/mon/PGMonitor.cc +++ b/src/mon/PGMonitor.cc @@ -267,10 +267,18 @@ bool PGMonitor::prepare_pg_stats(MPGStats *stats) { dout(10) << "prepare_pg_stats " << *stats << " from " << stats->get_orig_source() << dendl; int from = stats->get_orig_source().num(); + + if (!ceph_fsid_equal(&stats->fsid, &mon->monmap->fsid)) { + dout(0) << "handle_statfs on fsid " << stats->fsid << " != " << mon->monmap->fsid << dendl; + delete stats; + return false; + } if (!stats->get_orig_source().is_osd() || !mon->osdmon->osdmap.is_up(from) || stats->get_orig_source_inst() != mon->osdmon->osdmap.get_inst(from)) { dout(1) << " ignoring stats from non-active osd" << dendl; + delete stats; + return false; } // osd stat diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 5aa1b31b6e732..2eba360898601 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -1110,7 +1110,7 @@ void OSD::send_pg_stats() if (!pg_stat_pending.empty() || osd_stat_pending) { dout(1) << "send_pg_stats - " << pg_stat_pending.size() << " pgs updated" << dendl; - MPGStats *m = new MPGStats; + MPGStats *m = new MPGStats(osdmap->get_fsid()); for (map::iterator p = pg_stat_pending.begin(); p != pg_stat_pending.end(); p++) { -- 2.39.5