]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/osd_types: fix pg_t::contains() to check pool id too
authorSage Weil <sage@redhat.com>
Thu, 13 Sep 2018 18:31:40 +0000 (13:31 -0500)
committerPrashant D <pdhange@redhat.com>
Mon, 8 Oct 2018 21:36:51 +0000 (17:36 -0400)
This is used by bluestore fsck to ensure we're looking at the right
collection.  It needs to validate both that the pool id matches the
object (including the temp objects) and that the hash matches; we were
only checking the hash before.

Fixes: http://tracker.ceph.com/issues/32731
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 0bd2546eaca72ed0122a9c2648df4bef05b0d5d2)

src/common/hobject.h
src/osd/osd_types.h

index 24eeb9754e2f24290828a03e3fa372cb5aac691b..d05d294abe19bc671a564b206de5d69cd659aebb 100644 (file)
@@ -42,6 +42,7 @@ private:
   bool max;
   uint32_t nibblewise_key_cache;
   uint32_t hash_reverse_bits;
+public:
   static const int64_t POOL_META = -1;
   static const int64_t POOL_TEMP_START = -2; // and then negative
   friend class spg_t;  // for POOL_TEMP_START
index c211c58bbd17fb6a6084fa2bc46ce68dc23b4e4f..95dbab04553e46422487677ebcf15782a7f7e370 100644 (file)
@@ -419,10 +419,16 @@ struct pg_t {
   unsigned get_split_bits(unsigned pg_num) const;
 
   bool contains(int bits, const ghobject_t& oid) {
-    return oid.match(bits, ps());
+    return
+      ((int64_t)m_pool == oid.hobj.pool ||
+       hobject_t::POOL_TEMP_START-(int64_t)m_pool == oid.hobj.pool) &&
+      oid.match(bits, ps());
   }
   bool contains(int bits, const hobject_t& oid) {
-    return oid.match(bits, ps());
+    return
+      ((int64_t)m_pool == oid.pool ||
+       hobject_t::POOL_TEMP_START-(int64_t)m_pool == oid.pool) &&
+      oid.match(bits, ps());
   }
 
   hobject_t get_hobj_start() const;