]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: move misdirected op check from OSD thread to PG thread 6364/head
authorJason Dillaman <dillaman@redhat.com>
Fri, 23 Oct 2015 18:17:06 +0000 (14:17 -0400)
committerJason Dillaman <dillaman@redhat.com>
Fri, 23 Oct 2015 18:18:49 +0000 (14:18 -0400)
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>
src/osd/PG.cc
src/osd/ReplicatedPG.cc

index c6e2d38260fd993780fd7e22f64bb0dc285b265e..634d8299a5ea7c939c4ece81c59fe9a232e43e51 100644 (file)
@@ -5012,22 +5012,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 2b4eb8b1c52401aaf836e57d8b7a745a86737002..1b2c870bcb174dad793ffa3df1fb3635def5c131 100644 (file)
@@ -1496,6 +1496,23 @@ void ReplicatedPG::do_op(OpRequestRef& 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);