Skip to content

Commit

Permalink
os/bluestore: do not assert on insufficient allocation during bluefs
Browse files Browse the repository at this point in the history
rebalance

Signed-off-by: Igor Fedotov <ifedotov@suse.com>
  • Loading branch information
ifed01 committed Feb 6, 2018
1 parent eefdd80 commit 3b792f6
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/os/bluestore/BlueStore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5083,12 +5083,19 @@ int BlueStore::_balance_bluefs_freespace(PExtentVector *extents)
int64_t alloc_len = alloc->allocate(gift, cct->_conf->bluefs_alloc_size,
0, 0, &exts);

if (alloc_len < (int64_t)gift) {
derr << __func__ << " allocate failed on 0x" << std::hex << gift
<< " min_alloc_size 0x" << min_alloc_size << std::dec << dendl;
if (alloc_len <= 0) {
dout(1) << __func__ << " no allocate on 0x" << std::hex << gift
<< " min_alloc_size 0x" << min_alloc_size << std::dec << dendl;
alloc->unreserve(gift);
alloc->dump();
return 0;
} else if (alloc_len < (int64_t)gift) {
dout(1) << __func__ << " insufficient allocate on 0x" << std::hex << gift
<< " min_alloc_size 0x" << min_alloc_size
<< " allocated 0x" << alloc_len
<< std::dec << dendl;
alloc->unreserve(gift - alloc_len);
alloc->dump();
assert(0 == "allocate failed, wtf");
return -ENOSPC;
}
for (auto& p : exts) {
bluestore_pextent_t e = bluestore_pextent_t(p);
Expand Down Expand Up @@ -5601,7 +5608,6 @@ int BlueStore::_mount(bool kv_only, bool open_db)

mempool_thread.init();


mounted = true;
return 0;

Expand Down Expand Up @@ -8424,7 +8430,8 @@ void BlueStore::_txc_release_alloc(TransContext *txc)
{
// it's expected we're called with lazy_release_lock already taken!
if (likely(!cct->_conf->bluestore_debug_no_reuse_blocks)) {
dout(10) << __func__ << " " << txc << " " << txc->released << dendl;
dout(10) << __func__ << " " << txc << " " << std::hex
<< txc->released << std::dec << dendl;
alloc->release(txc->released);
}
txc->allocated.clear();
Expand Down

0 comments on commit 3b792f6

Please sign in to comment.