From: Samuel Just Date: Thu, 17 Sep 2015 17:54:18 +0000 (-0700) Subject: osd/: find_object_context: return obc for head for snapdir if non null X-Git-Tag: v9.1.0~105^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F6015%2Fhead;p=ceph.git osd/: find_object_context: return obc for head for snapdir if non null The head obc may have an in progress operation holding a lock, we need to block on the lock for ordering reasons. Fixes: #13143 Signed-off-by: Samuel Just --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 52bb6deff9da..b89aa2e32ff4 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -8418,13 +8418,16 @@ int ReplicatedPG::find_object_context(const hobject_t& oid, // want the snapdir? if (oid.snap == CEPH_SNAPDIR) { // return head or snapdir, whichever exists. - ObjectContextRef obc = get_object_context(head, can_create); + ObjectContextRef headobc = get_object_context(head, can_create); + ObjectContextRef obc = headobc; if (!obc || !obc->obs.exists) obc = get_object_context(oid, can_create); if (!obc || !obc->obs.exists) { // if we have neither, we would want to promote the head. if (pmissing) *pmissing = head; + if (pobc) + *pobc = headobc; // may be null return -ENOENT; } dout(10) << "find_object_context " << oid