From a11b3e8d63ddff7229e927c16dbffb03ba602f11 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Thu, 3 Apr 2014 12:52:38 -0700 Subject: [PATCH] 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 --- src/osd/ReplicatedPG.cc | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) 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; } -- 2.47.3