From: Sage Weil Date: Thu, 13 Nov 2014 01:11:10 +0000 (-0800) Subject: osd/OSD: use OSDMap helper to determine if we are correct op target X-Git-Tag: v0.89~14^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F2906%2Fhead;p=ceph.git osd/OSD: use OSDMap helper to determine if we are correct op target Use the new helper. This fixes our behavior for EC pools where targetting a different shard is not correct, while for replicated pools it may be. In the EC case, it leaves the op hanging indefinitely in the OpTracker because the pgid exists but as a different shard. Fixes: #9835 Signed-off-by: Sage Weil --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 76823edf77ed..7101cb1e3b85 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -8131,8 +8131,8 @@ void OSD::handle_op(OpRequestRef& op, OSDMapRef& osdmap) OSDMapRef send_map = service.try_get_map(m->get_map_epoch()); // check send epoch if (!send_map) { - - dout(7) << "don't have sender's osdmap; assuming it was valid and that client will resend" << dendl; + dout(7) << "don't have sender's osdmap; assuming it was valid and that" + << " client will resend" << dendl; return; } if (!send_map->have_pg_pool(pgid.pool())) { @@ -8145,7 +8145,8 @@ void OSD::handle_op(OpRequestRef& op, OSDMapRef& osdmap) << " when pool " << m->get_pg().pool() << " did not exist" << "\n"; return; - } else if (send_map->get_pg_acting_role(pgid.pgid, whoami) < 0) { + } + if (!send_map->osd_is_valid_op_target(pgid.pgid, whoami)) { dout(7) << "we are invalid target" << dendl; clog->warn() << m->get_source_inst() << " misdirected " << m->get_reqid() << " pg " << m->get_pg() @@ -8161,8 +8162,9 @@ void OSD::handle_op(OpRequestRef& op, OSDMapRef& osdmap) // check against current map too if (!osdmap->have_pg_pool(pgid.pool()) || - osdmap->get_pg_acting_role(pgid.pgid, whoami) < 0) { - dout(7) << "dropping; no longer have PG (or pool); client will retarget" << dendl; + !osdmap->osd_is_valid_op_target(pgid.pgid, whoami)) { + dout(7) << "dropping; no longer have PG (or pool); client will retarget" + << dendl; return; }