From 755c7c2c26af54524a0f186784cd0eaaf0bc7420 Mon Sep 17 00:00:00 2001 From: Jianpeng Ma Date: Thu, 28 Nov 2019 16:23:01 +0800 Subject: [PATCH] os/bluestore: don't round_up_to in apply_for_bitset_range. I met the following error messages: >sceph7: /home/Jianpeng/ceph/src/os/bluestore/bluestore_common.h: In function 'void apply_for_bitset_range(uint64_t, uint64_t, uint64_t, Bitset&, Func) [with Bitset = boost::dynamic_bitset; Func = BlueFS::_replay(bool, bool)::&)>; uint64_t = long unsigned int]' thread 7f7d55a3dd40 time 2019-11-27T23:26:05.949827+0800 >sceph7: /home/Jianpeng/ceph/src/os/bluestore/bluestore_common.h: 28: FAILED ceph_assert(end <= bitset.size()) >sceph7: ceph version 15.0.0-7747-g22a9a28e28 (22a9a28e2859718c4168f5b3cf6e20a9186e18bc) octopus (dev) >sceph7: 1: (ceph::__ceph_assert_fail(char const*, char const*, int, char const*)+0x14f) [0x56322c4440ef] >sceph7: 2: (()+0x50d2d9) [0x56322c4442d9] >sceph7: 3: (BlueFS::_replay(bool, bool)+0x5639) [0x56322cb51e49] >sceph7: 4: (BlueFS::mount()+0x269) [0x56322cb53289] >sceph7: 5: (BlueStore::_open_bluefs(bool)+0x29e) [0x56322ca6e38e] >sceph7: 6: (BlueStore::_open_db(bool, bool, bool)+0x59b) [0x56322ca6e9cb] >sceph7: 7: (BlueStore::mkfs()+0x749) [0x56322caaa259] >sceph7: 8: (OSD::mkfs(CephContext*, ObjectStore*, uuid_d, int)+0x1c8) [0x56322c5099e8] >sceph7: 9: (main()+0x1787) [0x56322c4ab117] >sceph7: 10: (__libc_start_main()+0xeb) [0x7f7d55b5fb6b] >sceph7: 11: (_start()+0x2a) [0x56322c4de71a] >sceph7: *** Caught signal (Aborted) ** >sceph7: in thread 7f7d55a3dd40 thread_name:ceph-osd If bdev[i]->get_size() / alloc_size[i] != 0, round_up_to(off+lengh,alloc_size[i])/alloc_size is larger than(one) ownend_blocks[i].size(). Signed-off-by: Jianpeng Ma --- src/os/bluestore/BlueFS.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index 39291dd6f7e..2d86d77d3aa 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -837,8 +837,8 @@ int BlueFS::_replay(bool noop, bool to_stdout) if (cct->_conf->bluefs_log_replay_check_allocations) { for (size_t i = 0; i < MAX_BDEV; ++i) { if (alloc_size[i] != 0 && bdev[i] != nullptr) { - used_blocks[i].resize(bdev[i]->get_size() / alloc_size[i]); - owned_blocks[i].resize(bdev[i]->get_size() / alloc_size[i]); + used_blocks[i].resize(round_up_to(bdev[i]->get_size(), alloc_size[i]) / alloc_size[i]); + owned_blocks[i].resize(round_up_to(bdev[i]->get_size(), alloc_size[i]) / alloc_size[i]); } } }