From 490938e3a9c663075d08d97757c86cee1244e18a Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Thu, 17 Sep 2015 10:54:18 -0700 Subject: [PATCH] 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 --- src/osd/ReplicatedPG.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 52bb6deff9da2..b89aa2e32ff40 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 -- 2.39.5