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-30 11:23:10 -0700
commit02ef6e918e4fe0368b02fbc700a4d921ae298dc3 (patch)
tree21629333d983f0075a4321c23818e0d5c098a7ce
parent85ad65e294f2b3d4bd1cfef6ae613e31d1cea635 (diff)
downloadceph-02ef6e918e4fe0368b02fbc700a4d921ae298dc3.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> (cherry picked from commit 29e4e7e316fe3f3028e6930bb5987cfe3a5e59ab)
-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 c751437671d..c01d328a512 100644
--- a/src/osd/ReplicatedPG.cc
+++ b/src/osd/ReplicatedPG.cc
@@ -4381,6 +4381,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);
}