]> git.apps.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)
committerSage Weil <sage@redhat.com>
Thu, 13 Sep 2018 18:31:40 +0000 (13:31 -0500)
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>
src/common/hobject.h
src/osd/osd_types.h

index b9f277bc8ef2782a7b59e51592adf5d0ac9ccd7a..dc40dead4d2d65c9334997b2b6c9c8ea7870fe4d 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 7c28877d1c6d088aa22d3e6b0a18bf68e865a987..684828fcf16080cb2cfcba76afdbc80c75b2cc01 100644 (file)
@@ -424,10 +424,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;