From 85abb02ad7d1a7c51e4fc2560eef1b528230c2fc Mon Sep 17 00:00:00 2001 From: Igor Fedotov Date: Wed, 18 Mar 2020 14:35:55 +0300 Subject: [PATCH] os/bluestore: fix extent leak after main device expand. To reproduce the issue one can expand device of 3,147,480,064 bytes to 4,147,480,064 using bluefs-bdev-expand command. Subsequent fsck will detect the leakage. Signed-off-by: Igor Fedotov --- src/os/bluestore/BitmapFreelistManager.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/os/bluestore/BitmapFreelistManager.cc b/src/os/bluestore/BitmapFreelistManager.cc index 7dcef4384adb1..13c60b4962e89 100644 --- a/src/os/bluestore/BitmapFreelistManager.cc +++ b/src/os/bluestore/BitmapFreelistManager.cc @@ -111,11 +111,11 @@ int BitmapFreelistManager::expand(uint64_t new_size, KeyValueDB::Transaction txn uint64_t blocks0 = size / bytes_per_block; if (blocks0 / blocks_per_key * blocks_per_key != blocks0) { - blocks0 = (blocks / blocks_per_key + 1) * blocks_per_key; + blocks0 = (blocks0 / blocks_per_key + 1) * blocks_per_key; dout(10) << __func__ << " rounding blocks up from 0x" << std::hex << size << " to 0x" << (blocks0 * bytes_per_block) << " (0x" << blocks0 << " blocks)" << std::dec << dendl; - // reset past-eof blocks to unallocated + // reset previous past-eof blocks to unallocated _xor(size, blocks0 * bytes_per_block - size, txn); } -- 2.39.5