From 49bebed03a8a1fda8fa35ae0954d91b5bec02396 Mon Sep 17 00:00:00 2001 From: yonghengdexin735 Date: Wed, 22 Feb 2017 15:12:04 +0800 Subject: [PATCH] os/bluestore:fixed bug for judging the return value in _open_alloc() Signed-off-by: yonghengdexin735 --- src/os/bluestore/BlueStore.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index d0039a34823f..d0ba78f7af6b 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -3760,6 +3760,13 @@ int BlueStore::_open_alloc() alloc = Allocator::create(cct, cct->_conf->bluestore_allocator, bdev->get_size(), min_alloc_size); + if (!alloc) { + lderr(cct) << __func__ << " Allocator::unknown alloc type " + << cct->_conf->bluestore_allocator + << dendl; + return -EINVAL; + } + uint64_t num = 0, bytes = 0; // initialize from freelist -- 2.47.3