]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
os/bluestore/BitMapAllocator: fix free space beyond size of BitAllocator
authorJianpeng Ma <jianpeng.ma@intel.com>
Mon, 6 Jun 2016 23:37:13 +0000 (07:37 +0800)
committerJianpeng Ma <jianpeng.ma@intel.com>
Mon, 6 Jun 2016 23:37:13 +0000 (07:37 +0800)
commitfca97f8619b33141217dcef5f06e45fb513ca6d1
tree00a9fe0c1acdcf2f805a39405423e98e93da4574
parent2d4aec9d7bff8a61801b5403212649752c7485b1
os/bluestore/BitMapAllocator: fix free space beyond size of BitAllocator

When Using bitmap allocator, the osd crashed. The stack info as
follows:

ceph-osd: os/bluestore/BitAllocator.cc:910: bool
BitAllocator::is_allocated(int64_t, int64_t): Assertion `start_block >=
0 && (start_block + num_blocks <= size())' failed.
*** Caught signal (Aborted) **
in thread 7f795bbc48c0 thread_name:ceph-osd ceph version
10.2.0-1333-g3f4cf16
(3f4cf16)
1: (()+0x98e25e) [0x55e112a9625e]
2: (()+0x109f0) [0x7f795a6719f0]
3: (gsignal()+0x38) [0x7f7958542a28]
4: (abort()+0x16a) [0x7f795854462a]
5: (()+0x2d227) [0x7f795853b227]
6: (()+0x2d2d2) [0x7f795853b2d2]
7: (()+0x7eaa59) [0x55e1128f2a59]
8: (BitAllocator::free_blocks(long, long)+0x22) [0x55e1128f2e82]
9: (BitMapAllocator::insert_free(unsigned long, unsigned long)+0x22c)
[0x55e1128ef12c]
10: (BitMapAllocator::init_add_free(unsigned long, unsigned long)+0x22c)
[0x55e1128ef41c]
11: (BlueFS::_init_alloc()+0x2b9) [0x55e1128c27b9]
12: (BlueFS::mkfs(uuid_d)+0x45a) [0x55e1128d475a]
13: (BlueStore::_open_db(bool)+0xd76) [0x55e1127bbcb6]
14: (BlueStore::mkfs()+0x8b1) [0x55e1127e4f11]
15: (OSD::mkfs(CephContext, ObjectStore, std::__cxx11::basic_string,
std::allocator > const&, uuid_d, int)+0x117) [0x55e112484de7]
16: (main()+0x101f) [0x55e112425f2f]
17: (__libc_start_main()+0xf0) [0x7f795852e580]
18: (_start()+0x29) [0x55e1124684e9]

This because in BitAllocator::init will decrease size of blkdev which
make size align w/ zone-size.
The later add free extent will beyond the size.

Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
src/os/bluestore/BitAllocator.cc
src/os/bluestore/BitAllocator.h
src/os/bluestore/BitMapAllocator.cc