summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-05-29 09:49:11 -0700
committerSage Weil <sage@inktank.com>2013-05-29 09:49:11 -0700
commit29e4e7e316fe3f3028e6930bb5987cfe3a5e59ab (patch)
tree6ef4ce2fe44b7f7c52e87c8e524675b4e4062d95
parent1bb4e7435c3797b08aa185265425b2cb6efb66a2 (diff)
downloadceph-29e4e7e316fe3f3028e6930bb5987cfe3a5e59ab.tar.gz
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 <sage@inktank.com> Reviewed-by: Samuel Just <sam.just@inktank.com>
-rw-r--r--src/osd/ReplicatedPG.cc5
1 files changed, 5 insertions, 0 deletions
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);
}