]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd: blocking read op if object is degraded
authormyoungwon oh <omwmw@sk.com>
Mon, 20 Nov 2017 08:35:05 +0000 (17:35 +0900)
committermyoungwon oh <omwmw@sk.com>
Mon, 20 Nov 2017 08:35:05 +0000 (17:35 +0900)
This commit prevents promote_object() if object need to be blocked

Signed-off-by: Myoungwon Oh <omwmw@sk.com>
src/osd/PrimaryLogPG.cc
src/osd/PrimaryLogPG.h

index ca6ae5915b66395c6d73f30d733b2148f6f17180..eb4e23bbc005433b42e83100bfc74c384c8874df 100644 (file)
@@ -2343,21 +2343,40 @@ PrimaryLogPG::cache_result_t PrimaryLogPG::maybe_handle_manifest_detail(
       do_proxy_read(op, obc);
     }
     return cache_result_t::HANDLED_PROXY;
-  case object_manifest_t::TYPE_CHUNKED:
-    if (can_proxy_chunked_read(op, obc)) {
-      do_proxy_chunked_op(op, obc->obs.oi.soid, obc, write_ordered);
-      return cache_result_t::HANDLED_PROXY;
-    }
-    
-    for (auto& p : obc->obs.oi.manifest.chunk_map) {
-      if (p.second.flags == chunk_info_t::FLAG_MISSING) {
-       const MOSDOp *m = static_cast<const MOSDOp*>(op->get_req());
-       const object_locator_t oloc = m->get_object_locator();
-       promote_object(obc, obc->obs.oi.soid, oloc, op, NULL);
-       return cache_result_t::BLOCKED_PROMOTE;
+  case object_manifest_t::TYPE_CHUNKED: 
+    {
+      if (can_proxy_chunked_read(op, obc)) {
+       do_proxy_chunked_op(op, obc->obs.oi.soid, obc, write_ordered);
+       return cache_result_t::HANDLED_PROXY;
+      }
+
+      MOSDOp *m = static_cast<MOSDOp*>(op->get_nonconst_req());
+      assert(m->get_type() == CEPH_MSG_OSD_OP);
+      hobject_t head = m->get_hobj();
+
+      if (is_degraded_or_backfilling_object(head)) {
+       dout(20) << __func__ << ": " << head << " is degraded, waiting" << dendl;
+       wait_for_degraded_object(head, op);
+       return cache_result_t::BLOCKED_RECOVERY;
+      }
+
+      if (scrubber.write_blocked_by_scrub(head)) {
+       dout(20) << __func__ << ": waiting for scrub" << dendl;
+       waiting_for_scrub.push_back(op);
+       op->mark_delayed("waiting for scrub");
+       return cache_result_t::BLOCKED_RECOVERY;
+      }
+      
+      for (auto& p : obc->obs.oi.manifest.chunk_map) {
+       if (p.second.flags == chunk_info_t::FLAG_MISSING) {
+         const MOSDOp *m = static_cast<const MOSDOp*>(op->get_req());
+         const object_locator_t oloc = m->get_object_locator();
+         promote_object(obc, obc->obs.oi.soid, oloc, op, NULL);
+         return cache_result_t::BLOCKED_PROMOTE;
+       }
       }
+      return cache_result_t::NOOP;
     }
-    return cache_result_t::NOOP;
   default:
     assert(0 == "unrecognized manifest type");
   }
index bda615b2de5e35ac0aa22532d86ce4f14e28285a..b16dad575fda07af6e3868bf7f462c375135b548 100644 (file)
@@ -1137,6 +1137,7 @@ protected:
     HANDLED_PROXY,
     HANDLED_REDIRECT,
     REPLIED_WITH_EAGAIN,
+    BLOCKED_RECOVERY,
   };
   cache_result_t maybe_handle_cache_detail(OpRequestRef op,
                                           bool write_ordered,