]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: Improve SnapMapper handling of inconsistencies
authorDavid Zafman <dzafman@redhat.com>
Wed, 7 Nov 2018 22:23:29 +0000 (14:23 -0800)
committerDavid Zafman <dzafman@redhat.com>
Wed, 7 Nov 2018 22:23:29 +0000 (14:23 -0800)
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 <dzafman@redhat.com>
src/osd/PG.cc
src/osd/SnapMapper.cc

index 7a777d3fbd7c36bd9c405124bb553dff9266146c..e909a8971ed3a86e8ec0d2329430eb5f79a94419 100644 (file)
@@ -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<snapid_t> snaps;
index 3e4b1abf1b8270196572009741f44bdc4bef4c04..4c82d5a3b37008fbe12ae7b8cc8fa397d9def35b 100644 (file)
@@ -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);