From 29e4e7e316fe3f3028e6930bb5987cfe3a5e59ab Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 29 May 2013 09:49:11 -0700 Subject: 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 --- src/osd/ReplicatedPG.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 761a77cd69c..e050eb3d8ee 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); } -- cgit v1.2.1