]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/OSD: use OSDMap helper to determine if we are correct op target 2906/head
authorSage Weil <sage@redhat.com>
Thu, 13 Nov 2014 01:11:10 +0000 (17:11 -0800)
committerSage Weil <sage@redhat.com>
Thu, 13 Nov 2014 01:11:10 +0000 (17:11 -0800)
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 <sage@redhat.com>
src/osd/OSD.cc

index 76823edf77eda1eca2e38894ed60a53f0c4acbc4..7101cb1e3b8531eccde6d357d949a6d44471ae53 100644 (file)
@@ -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;
   }