]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG::promote_object: check scrubber and block if necessary 4185/head
authorSamuel Just <sjust@redhat.com>
Fri, 20 Mar 2015 22:28:15 +0000 (15:28 -0700)
committerLoic Dachary <ldachary@redhat.com>
Wed, 25 Mar 2015 20:58:10 +0000 (21:58 +0100)
Otherwise, we might attempt to promote into an in-progress scrub
interval causing 11156.  I would have added a return value to
promote_object(), but could not find an existing user which
cared to distinguish the cases, even with a null op passed.
All existing users are in maybe_handle_cache.  The ones which
pass a null op are for promoting the object in parallel
with a proxy -- a case where not actually performing the promote
does not really matter.

Fixes: #11156
Signed-off-by: Samuel Just <sjust@redhat.com>
(cherry picked from commit 65bb4df599541cd2e0f195b905f24f529e255c00)

src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index 25b026961cfedb7f0c502a5c4eb4113befbc782e..ed7abb54275381dfc6bf70eb7a4a75a7fa7f167f 100644 (file)
@@ -1697,6 +1697,19 @@ void ReplicatedPG::promote_object(OpRequestRef op, ObjectContextRef obc,
     obc = get_object_context(missing_oid, true);
   }
   dout(10) << __func__ << " " << obc->obs.oi.soid << dendl;
+  if (scrubber.write_blocked_by_scrub(obc->obs.oi.soid)) {
+    dout(10) << __func__ << " " << obc->obs.oi.soid
+            << " blocked by scrub" << dendl;
+    if (op) {
+      waiting_for_active.push_back(op);
+      dout(10) << __func__ << " " << obc->obs.oi.soid
+              << " placing op in waiting_for_active" << dendl;
+    } else {
+      dout(10) << __func__ << " " << obc->obs.oi.soid
+              << " no op, dropping on the floor" << dendl;
+    }
+    return;
+  }
 
   PromoteCallback *cb = new PromoteCallback(op, obc, this);
   object_locator_t oloc(m->get_object_locator());
index dc8ee62585949c3b0873fbf83e7fd048f6cb9f51..4b0d1d69441877048cf3b44800fbcc3c3fa8d8df 100644 (file)
@@ -1060,7 +1060,10 @@ protected:
    */
   void do_cache_redirect(OpRequestRef op, ObjectContextRef obc);
   /**
-   * This function starts up a copy from
+   * This function attempts to start a promote.  Either it succeeds,
+   * or places op on a wait list.  If op is null, failure means that
+   * this is a noop.  If a future user wants to be able to distinguish
+   * these cases, a return value should be added.
    */
   void promote_object(OpRequestRef op, ObjectContextRef obc,
                      const hobject_t& missing_object);