From 89d906c871e0db6ddf0a39144efb5156c6ee7e3b Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Tue, 17 May 2016 20:35:16 +0800 Subject: [PATCH] os/bluestore/BitAllocator: fix is_allocated() may return false positive Signed-off-by: xie xingguo --- src/os/bluestore/BitAllocator.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/os/bluestore/BitAllocator.cc b/src/os/bluestore/BitAllocator.cc index f88bae7468c7a..bc19fd43dadd2 100644 --- a/src/os/bluestore/BitAllocator.cc +++ b/src/os/bluestore/BitAllocator.cc @@ -935,7 +935,8 @@ bool BitAllocator::is_allocated(int64_t start_block, int64_t num_blocks) bool BitAllocator::is_allocated(int64_t *alloc_blocks, int64_t num_blocks) { for (int64_t i = 0; i < num_blocks; i++) { - return is_allocated(alloc_blocks[i], 1); + if (!is_allocated(alloc_blocks[i], 1)) + return false; } return true; -- 2.39.5