From: Sage Weil Date: Wed, 29 May 2013 16:49:11 +0000 (-0700) Subject: osd: do not assume head obc object exists when getting snapdir X-Git-Tag: v0.64~39 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=29e4e7e316fe3f3028e6930bb5987cfe3a5e59ab;p=ceph.git osd: do not assume head obc object exists when getting snapdir For a list-snaps operation on the snapdir, do not assume that the obc for the head means the object exists. This fixes a race between a head deletion and a list-snaps that wrongly returns ENOENT, triggered by the DiffItersateStress test when thrashing OSDs. Fixes: #5183 Backport: cuttlefish Signed-off-by: Sage Weil Reviewed-by: Samuel Just --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 761a77cd69c8..e050eb3d8eef 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -4383,6 +4383,11 @@ int ReplicatedPG::find_object_context(const hobject_t& oid, if (oid.snap == CEPH_SNAPDIR) { // return head or snapdir, whichever exists. ObjectContext *obc = get_object_context(head, oloc, can_create); + if (obc && !obc->obs.exists) { + // ignore it if the obc exists but the object doesn't + put_object_context(obc); + obc = NULL; + } if (!obc) { obc = get_object_context(snapdir, oloc, can_create); }