From: xie xingguo Date: Tue, 17 May 2016 12:35:16 +0000 (+0800) Subject: os/bluestore/BitAllocator: fix is_allocated() may return false positive X-Git-Tag: v11.0.0~367^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=89d906c871e0db6ddf0a39144efb5156c6ee7e3b;p=ceph.git os/bluestore/BitAllocator: fix is_allocated() may return false positive Signed-off-by: xie xingguo --- diff --git a/src/os/bluestore/BitAllocator.cc b/src/os/bluestore/BitAllocator.cc index f88bae7468c7..bc19fd43dadd 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;