]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: do not assume head obc object exists when getting snapdir
authorSage Weil <sage@inktank.com>
Wed, 29 May 2013 16:49:11 +0000 (09:49 -0700)
committerSage Weil <sage@inktank.com>
Wed, 29 May 2013 16:49:11 +0000 (09:49 -0700)
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>
src/osd/ReplicatedPG.cc

index 761a77cd69c846e6225e1d5c740721d39c8cac1f..e050eb3d8eef2341d2da091942e65f332cf3c002 100644 (file)
@@ -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);
     }