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>
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);
}