]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
redirect balanced reads to acting primary when necessary 15489/head
authorXuehan Xu <xxhdx1985126@163.com>
Mon, 5 Jun 2017 16:17:31 +0000 (00:17 +0800)
committerXuehan Xu <xxhdx1985126@163.com>
Sun, 18 Jun 2017 07:46:00 +0000 (15:46 +0800)
Redirect balanced read requests to acting primary when the
targeting object hasn't been recovered on replica OSDs.

Fixes: http://tracker.ceph.com/issues/17968
Signed-off-by: Xuehan Xu <xxhdx1985126@163.com>
src/osd/PrimaryLogPG.cc
src/osdc/Objecter.cc

index 3f5adc1f33d09b0d07da85b7d83ebcca97847fd8..efe034ef4eb4685eeb19dcfa5f15eefeffa01f42 100644 (file)
@@ -1989,6 +1989,10 @@ void PrimaryLogPG::do_op(OpRequestRef& op)
 
   // missing object?
   if (is_unreadable_object(head)) {
+    if (!is_primary()) {
+      osd->reply_op_error(op, -EAGAIN);
+      return;
+    }
     if (can_backoff &&
        (g_conf->osd_backoff_on_degraded ||
         (g_conf->osd_backoff_on_unfound && missing_loc.is_unfound(head)))) {
index 6e4d24259cd02f604c3fab0119816549b0a679db..78a39f0b0f43a8f2e92f79339c8908b9b73da451 100644 (file)
@@ -3412,6 +3412,22 @@ void Objecter::handle_osd_op_reply(MOSDOpReply *m)
   if (rc == -EAGAIN) {
     ldout(cct, 7) << " got -EAGAIN, resubmitting" << dendl;
 
+    if ((op->target.flags & CEPH_OSD_FLAG_BALANCE_READS) 
+       && (op->target.acting_primary != op->target.osd)) {
+      if (op->onfinish)
+       num_in_flight--;
+      _session_op_remove(s, op);
+      sl.unlock();
+      put_session(s);
+
+      op->tid = 0;
+      op->target.flags &= ~CEPH_OSD_FLAG_BALANCE_READS;
+      op->target.pgid = pg_t();
+      _op_submit(op, sul, NULL);
+      m->put();
+      return;
+    }
+
     // new tid
     s->ops.erase(op->tid);
     op->tid = ++last_tid;