From: Sage Weil Date: Tue, 11 Apr 2017 19:15:51 +0000 (-0400) Subject: osd/osd_types: fix pi_compact_rep empty() condition X-Git-Tag: v12.0.3~129^2~23 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2fd345188b8d25d38a9ee52c45c7462248c8ea07;p=ceph.git osd/osd_types: fix pi_compact_rep empty() condition We may have no intervals but still be non-empty (have a first and last), because during that period there were no osds. This easily happens when a pool is created before osds are up. Signed-off-by: Sage Weil --- diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index 274e7441ee6e..0743f86304cb 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -3090,7 +3090,9 @@ public: pi_compact_rep &operator=(pi_compact_rep &&) = default; size_t size() const override { return intervals.size(); } - bool empty() const override { return intervals.empty(); } + bool empty() const override { + return first > last || (first == 0 && last == 0); + } void clear() override { *this = pi_compact_rep(); }