]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG: test for missing head before find_object_context
authorSamuel Just <sam.just@inktank.com>
Tue, 12 Nov 2013 23:15:26 +0000 (15:15 -0800)
committerSamuel Just <sam.just@inktank.com>
Thu, 14 Nov 2013 20:25:36 +0000 (12:25 -0800)
find_object_context doesn't return EAGAIN for a missing head.
I chose not to change that behavior since it might hide bugs
in the future.  All other callers check for missing on head
before calling into find_object_context because we potentially
need head or snapdir to map a snapid onto a clone.

Backport: emperor
Fixes: 6758
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Reviewed-by: David Zafman <david.zafman@inktank.com>
src/common/hobject.h
src/osd/ReplicatedPG.cc

index 3c2202df4b1b56157098c3acaf9451d043bcf56f..4081ceb8f852363aaae52ef0a9ab6d4a68b0fcfa 100644 (file)
@@ -98,6 +98,11 @@ public:
     return ret;
   }
 
+  /// @return true if object is head
+  bool is_head() const {
+    return snap == CEPH_NOSNAP;
+  }
+
   /// @return true if object is neither head nor snapdir
   bool is_snap() const {
     return (snap != CEPH_NOSNAP) && (snap != CEPH_SNAPDIR);
index e82331738bef947e361a15ea0aa1cce53fe67a17..57d9ec72bbd423f89baea2204dfd86f5ae46cc06 100644 (file)
@@ -1046,9 +1046,12 @@ void ReplicatedPG::do_op(OpRequestRef op)
       if (!src_obc.count(src_oid)) {
        ObjectContextRef sobc;
        snapid_t ssnapid;
+       int r;
 
-       int r = find_object_context(src_oid, &sobc, false, &ssnapid);
-       if (r == -EAGAIN) {
+       if (src_oid.is_head() && is_missing_object(src_oid)) {
+         wait_for_missing_object(src_oid, op);
+       } else if ((r = find_object_context(
+                     src_oid, &sobc, false, &ssnapid)) == -EAGAIN) {
          // missing the specific snap we need; requeue and wait.
          hobject_t wait_oid(osd_op.soid.oid, src_oloc.key, ssnapid, m->get_pg().ps(),
                             info.pgid.pool(), m->get_object_locator().nspace);