From 9e05ba086a36ae9a04b347153b685c2b8adac2c3 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 12 Nov 2014 17:11:10 -0800 Subject: [PATCH] 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 --- src/osd/OSD.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 76823edf77eda..7101cb1e3b853 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; } -- 2.39.5