]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG::do_op: use get_object_context for list-snaps 1615/head
authorSamuel Just <sam.just@inktank.com>
Thu, 3 Apr 2014 19:52:38 +0000 (12:52 -0700)
committerSamuel Just <sam.just@inktank.com>
Thu, 3 Apr 2014 19:53:51 +0000 (12:53 -0700)
find_object_context provides some niceties which we don't need since we know
the oid of the clones.  Problematically, it also return ENOENT if the snap
requested happens to have been removed.  Even in such a case, the clone may
well still exist for other snaps.  Rather than modify find_object_context to
avoid this situation for this caller, we'll simply do it inline in do_op.

Fixes: #7858
Signed-off-by: Samuel Just <sam.just@inktank.com>
src/osd/ReplicatedPG.cc

index 85ef5e2b7ea5bd6e69d8eff5ca709f0044efd883..1cba0a7b199345c69d439b4d7e404e2f66ebb466 100644 (file)
@@ -1389,27 +1389,25 @@ void ReplicatedPG::do_op(OpRequestRef op)
     for (vector<snapid_t>::iterator p = obc->ssc->snapset.clones.begin();
         p != obc->ssc->snapset.clones.end();
         ++p) {
-      object_locator_t src_oloc;
-      get_src_oloc(m->get_oid(), m->get_object_locator(), src_oloc);
       hobject_t clone_oid = obc->obs.oi.soid;
       clone_oid.snap = *p;
       if (!src_obc.count(clone_oid)) {
-       ObjectContextRef sobc;
-       hobject_t wait_oid;
+       if (is_unreadable_object(clone_oid)) {
+         wait_for_unreadable_object(clone_oid, op);
+         return;
+       }
 
-       int r = find_object_context(clone_oid, &sobc, false, &wait_oid);
-       if (r == -EAGAIN) {
-         // missing the specific snap we need; requeue and wait.
-         wait_for_unreadable_object(wait_oid, op);
-       } else if (r) {
-         if (!maybe_handle_cache(op, write_ordered, sobc, r, wait_oid, true))
-           osd->reply_op_error(op, r);
+       ObjectContextRef sobc = get_object_context(clone_oid, false);
+       if (!sobc) {
+         if (!maybe_handle_cache(op, write_ordered, sobc, -ENOENT, clone_oid, true))
+           osd->reply_op_error(op, -ENOENT);
+         return;
        } else {
          dout(10) << " clone_oid " << clone_oid << " obc " << sobc << dendl;
          src_obc[clone_oid] = sobc;
          continue;
        }
-       return;
+       assert(0); // unreachable
       } else {
        continue;
       }