]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/OSD: use OSDMap helper to determine if we are correct op target
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 18:38:12 +0000 (10:38 -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>
(cherry picked from commit 9e05ba086a36ae9a04b347153b685c2b8adac2c3)

src/osd/OSD.cc

index 322cf5c0f6b2d2fcc6e667d27f70a791a2bd2905..f45dd6b809d14b978f747234ed9dd40e0ed1a32d 100644 (file)
@@ -8095,8 +8095,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())) {
@@ -8109,7 +8109,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()
@@ -8125,8 +8126,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;
   }