]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: move misdirected op check from OSD thread to PG thread 6629/head
authorJason Dillaman <dillaman@redhat.com>
Fri, 23 Oct 2015 18:17:06 +0000 (14:17 -0400)
committerAbhishek Varshney <abhishek.varshney@flipkart.com>
Mon, 23 Nov 2015 06:36:29 +0000 (12:06 +0530)
The op message isn't fully decoded until after the start of the PG
op handling.  Therefore, checking for misdirected ops needs to wait
until after the RWM flags have been initialized.

Fixes: #13491
Backport: infernalis
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit 56ba90f5e49d499ea9f6bda9665031ce90abdc32)

Conflicts:
src/osd/ReplicatedPG.cc
In ReplicatedPG::do_op, resolved conflicts caused by afcfb050930e2e4086d631119022fd2dee9feb21 and 818d790f7d424520bc96c651571f2c86e94caf1e

src/osd/PG.cc
src/osd/ReplicatedPG.cc

index c13321c7b37abafcf340ce4c686d8c293ed13b0c..17b29d607f7a6a52d0d1e37a3fa06aaa5992e74f 100644 (file)
@@ -5066,22 +5066,6 @@ bool PG::can_discard_op(OpRequestRef& op)
     return true;
   }
 
-  if ((m->get_flags() & (CEPH_OSD_FLAG_BALANCE_READS |
-                        CEPH_OSD_FLAG_LOCALIZE_READS)) &&
-      op->may_read() &&
-      !(op->may_write() || op->may_cache())) {
-    // balanced reads; any replica will do
-    if (!(is_primary() || is_replica())) {
-      osd->handle_misdirected_op(this, op);
-      return true;
-    }
-  } else {
-    // normal case; must be primary
-    if (!is_primary()) {
-      osd->handle_misdirected_op(this, op);
-      return true;
-    }
-  }
   if (is_replay()) {
     if (m->get_version().version > 0) {
       dout(7) << " queueing replay at " << m->get_version()
index 7d5946b64e2bcab79e1074ac6b999cb26c568e12..00a84154b01e085eb14d3d501ad3869c5bf23170 100644 (file)
@@ -1488,6 +1488,24 @@ void ReplicatedPG::do_op(OpRequestRef& op)
 {
   MOSDOp *m = static_cast<MOSDOp*>(op->get_req());
   assert(m->get_type() == CEPH_MSG_OSD_OP);
+
+  if ((m->get_flags() & (CEPH_OSD_FLAG_BALANCE_READS |
+                        CEPH_OSD_FLAG_LOCALIZE_READS)) &&
+      op->may_read() &&
+      !(op->may_write() || op->may_cache())) {
+    // balanced reads; any replica will do
+    if (!(is_primary() || is_replica())) {
+      osd->handle_misdirected_op(this, op);
+      return;
+    }
+  } else {
+    // normal case; must be primary
+    if (!is_primary()) {
+      osd->handle_misdirected_op(this, op);
+      return;
+    }
+  }
+
   if (op->includes_pg_op()) {
     if (pg_op_must_wait(m)) {
       wait_for_all_missing(op);