]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/PGMap: assert our pg counts don't go negative
authorSage Weil <sage@redhat.com>
Thu, 8 Oct 2015 16:15:01 +0000 (12:15 -0400)
committerSage Weil <sage@redhat.com>
Mon, 23 Nov 2015 13:38:49 +0000 (08:38 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/PGMap.cc

index 1eee600e7cf75519c8b6975dfdb5ed2654706cbc..412b00b8760c887cf1fdb6c25f217de004dfc197 100644 (file)
@@ -501,7 +501,9 @@ void PGMap::stat_pg_sub(const pg_t &pgid, const pg_stat_t &s, bool nocreating,
   pg_sum.sub(s);
 
   num_pg--;
-  if (--num_pg_by_state[s.state] == 0)
+  int end = --num_pg_by_state[s.state];
+  assert(end >= 0);
+  if (end == 0)
     num_pg_by_state.erase(s.state);
 
   if (!nocreating) {