Skip to content

Commit

Permalink
osd/osd_types: fix pg_t::contains() to check pool id too
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
liewegas committed Sep 13, 2018
1 parent ad9fc49 commit 0bd2546
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/common/hobject.h
Expand Up @@ -42,6 +42,7 @@ struct hobject_t {
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
Expand Down
10 changes: 8 additions & 2 deletions src/osd/osd_types.h
Expand Up @@ -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;
Expand Down

0 comments on commit 0bd2546

Please sign in to comment.