Skip to content

Commit

Permalink
os/bluestore: fix bloom filter num entry miscalculation in the repairer
Browse files Browse the repository at this point in the history
This could  cause an assertion due to an access to uninitialized bloom
filter. This happened  when detecting errors involving physical extents close to the end of a large partition.
E.g. it was observed in http://tracker.ceph.com/issues/25001 while trying to repair an OSD.

Fixes: https://tracker.ceph.com/issues/35971

Signed-off-by: Igor Fedotov <ifedotov@suse.com>
  • Loading branch information
ifed01 committed Sep 13, 2018
1 parent d53dd38 commit 5091981
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/os/bluestore/BlueStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -2882,7 +2882,7 @@ class BlueStoreRepairer
granularity = round_up_to(granularity, min_alloc_size);
}

uint64_t entries = p2roundup(total, granularity) / granularity;
uint64_t entries = round_up_to(total, granularity) / granularity;
collections_bfs.resize(entries,
bloom_filter(BLOOM_FILTER_SALT_COUNT,
BLOOM_FILTER_TABLE_SIZE,
Expand Down
11 changes: 11 additions & 0 deletions src/test/objectstore/test_bluestore_types.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1529,6 +1529,17 @@ TEST(BlueStoreRepairer, StoreSpaceTracker)
ASSERT_EQ(3u, bmap.filter_out(extents));
ASSERT_TRUE(bmap.is_used(cid));
ASSERT_TRUE(bmap.is_used(hoid));

BlueStoreRepairer::StoreSpaceTracker bmap2;
bmap2.init((uint64_t)0x3223b1d1000, 0x10000);
ASSERT_EQ(bmap2.granularity, 0x1a0000);
ASSERT_EQ(bmap2.collections_bfs.size(), 0x1edae4);
ASSERT_EQ(bmap2.objects_bfs.size(), 0x1edae4);
bmap2.set_used(0x3223b190000, 0x10000, cid, hoid);
ASSERT_TRUE(bmap2.is_used(cid, 0x3223b190000));
ASSERT_TRUE(bmap2.is_used(hoid, 0x3223b190000));
ASSERT_TRUE(bmap2.is_used(cid, 0x3223b19f000));
ASSERT_TRUE(bmap2.is_used(hoid, 0x3223b19ffff));
}

int main(int argc, char **argv) {
Expand Down

0 comments on commit 5091981

Please sign in to comment.