From: Samuel Just Date: Thu, 3 Apr 2014 19:52:38 +0000 (-0700) Subject: ReplicatedPG::do_op: use get_object_context for list-snaps X-Git-Tag: v0.80-rc1~89^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a11b3e8d63ddff7229e927c16dbffb03ba602f11;p=ceph.git ReplicatedPG::do_op: use get_object_context for list-snaps 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 --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 85ef5e2b7ea5..1cba0a7b1993 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -1389,27 +1389,25 @@ void ReplicatedPG::do_op(OpRequestRef op) for (vector::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; }