From: Sage Weil Date: Thu, 16 Feb 2017 21:58:29 +0000 (-0500) Subject: osd: avoid require_mon_peer stray put() X-Git-Tag: v12.0.1~279^2~25 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=72d72da6a2574158fd5312c28935eb652c258e1d;p=ceph.git osd: avoid require_mon_peer stray put() For the handle_pg_create caller we cannot put the ref; do it in the callers instead. Signed-off-by: Sage Weil --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 08b727f5d25b..695386113862 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -5373,6 +5373,7 @@ void OSD::handle_pg_stats_ack(MPGStatsAck *ack) dout(10) << "handle_pg_stats_ack " << dendl; if (!require_mon_peer(ack)) { + ack->put(); return; } @@ -5456,8 +5457,10 @@ void OSD::flush_pg_stats() void OSD::handle_command(MMonCommand *m) { - if (!require_mon_peer(m)) + if (!require_mon_peer(m)) { + m->put(); return; + } Command *c = new Command(m->cmd, m->get_tid(), m->get_data(), NULL); command_wq.queue(c); @@ -6575,8 +6578,10 @@ void OSD::handle_pg_scrub(MOSDScrub *m, PG *pg) void OSD::handle_scrub(MOSDScrub *m) { dout(10) << "handle_scrub " << *m << dendl; - if (!require_mon_peer(m)) + if (!require_mon_peer(m)) { + m->put(); return; + } if (m->fsid != monc->get_fsid()) { dout(0) << "handle_scrub fsid " << m->fsid << " != " << monc->get_fsid() << dendl; m->put(); @@ -7616,13 +7621,12 @@ void OSD::activate_map() take_waiters(waiting_for_osdmap); } -bool OSD::require_mon_peer(Message *m) +bool OSD::require_mon_peer(const Message *m) { if (!m->get_connection()->peer_is_mon()) { dout(0) << "require_mon_peer received from non-mon " << m->get_connection()->get_peer_addr() << " " << *m << dendl; - m->put(); return false; } return true; @@ -7789,16 +7793,9 @@ void OSD::handle_pg_create(OpRequestRef op) dout(10) << "handle_pg_create " << *m << dendl; - /* we have to hack around require_mon_peer's interface limits, so - * grab an extra reference before going in. If the peer isn't - * a Monitor, the reference is put for us (and then cleared - * up automatically by our OpTracker infrastructure). Otherwise, - * we put the extra ref ourself. - */ - if (!require_mon_peer(op->get_req()->get())) { + if (!require_mon_peer(op->get_req())) { return; } - op->get_req()->put(); if (!require_same_or_newer_map(op, m->epoch, false)) return; diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 3beb717e419f..4b6755da9560 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -2230,7 +2230,7 @@ protected: vector > >& info_map, OSDMapRef map); - bool require_mon_peer(Message *m); + bool require_mon_peer(const Message *m); bool require_osd_peer(Message *m); /*** * Verifies that we were alive in the given epoch, and that