From: David Zafman Date: Wed, 7 Nov 2018 22:23:29 +0000 (-0800) Subject: osd: Improve SnapMapper handling of inconsistencies X-Git-Tag: v14.1.0~947^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4ff0ecc5108b867e8770d97918917ee5147dc3d5;p=ceph.git osd: Improve SnapMapper handling of inconsistencies My using nop() instead of setattr() we avoid crashing a replica that is missing the object for some reason. Although this is a corruption, it would be getting "fix" by removal of the snapshot. In the other cases we accept completely missing keys (ENOENT) that happens when an object is removed somehow or missed by recovery/backfill. Signed-off-by: David Zafman --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 7a777d3fbd7..e909a8971ed 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -4015,7 +4015,10 @@ void PG::update_snap_map( int r = snap_mapper.remove_oid( i->soid, &_t); - ceph_assert(r == 0); + if (r != 0) + derr << __func__ << " remove_oid " << i->soid << " failed with " << r << dendl; + // On removal tolerate missing key corruption + ceph_assert(r == 0 || r == -ENOENT); } else if (i->is_update()) { ceph_assert(i->snaps.length() > 0); vector snaps; diff --git a/src/osd/SnapMapper.cc b/src/osd/SnapMapper.cc index 3e4b1abf1b8..4c82d5a3b37 100644 --- a/src/osd/SnapMapper.cc +++ b/src/osd/SnapMapper.cc @@ -226,7 +226,8 @@ int SnapMapper::update_snaps( object_snaps out; int r = get_snaps(oid, &out); - if (r < 0) + // Tolerate missing keys but not disk errors + if (r < 0 && r != -ENOENT) return r; if (old_snaps_check) ceph_assert(out.snaps == *old_snaps_check);