]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
PG: fix cached_removed_snaps bug in PGPool::update after map gap 12906/head
authorSamuel Just <sjust@redhat.com>
Mon, 12 Dec 2016 18:35:38 +0000 (10:35 -0800)
committerNathan Cutler <ncutler@suse.com>
Thu, 12 Jan 2017 16:16:39 +0000 (17:16 +0100)
5798fb3bf6d726d14a9c5cb99dc5902eba5b878a actually made 15943 worse
by always creating an out-of-date cached_removed_snaps value after
a map gap rather than only in the case where the the first map after
the gap did not remove any snapshots.

Introduced: 5798fb3bf6d726d14a9c5cb99dc5902eba5b878a
Fixes: http://tracker.ceph.com/issues/15943
Signed-off-by: Samuel Just <sjust@redhat.com>
(cherry picked from commit 5642e7e1b3bb6ffceddacd2f4030eb13a17fcccc)

src/osd/PG.cc

index 5a9f2b50186aef90a4207a94f12694519847f98d..06a7645a716905b4f526a8e870d198f78bf01632 100644 (file)
@@ -157,7 +157,7 @@ void PGPool::update(OSDMapRef map)
   auid = pi->auid;
   name = map->get_pool_name(id);
   bool updated = false;
-  if ((map->get_epoch() == cached_epoch + 1) &&
+  if ((map->get_epoch() != cached_epoch + 1) ||
       (pi->get_snap_epoch() == map->get_epoch())) {
     updated = true;
     pi->build_removed_snaps(newly_removed_snaps);
@@ -175,6 +175,16 @@ void PGPool::update(OSDMapRef map)
     }
     snapc = pi->get_snap_context();
   } else {
+    /* 1) map->get_epoch() == cached_epoch + 1 &&
+     * 2) pi->get_snap_epoch() != map->get_epoch()
+     *
+     * From the if branch, 1 && 2 must be true.  From 2, we know that
+     * this map didn't change the set of removed snaps.  From 1, we
+     * know that our cached_removed_snaps matches the previous map.
+     * Thus, from 1 && 2, cached_removed snaps matches the current
+     * set of removed snaps and all we have to do is clear
+     * newly_removed_snaps.
+     */
     newly_removed_snaps.clear();
   }
   cached_epoch = map->get_epoch();