summaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
authorZheng Qixing <zhengqixing@huawei.com>2025-04-03 09:53:22 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-04-25 10:45:39 +0200
commit0b5390aeaa85eb2f15e0e2ea0731c0995285db5e (patch)
treeb9c5212f9339da452e18096006828ee04a37982d /drivers/md
parentf10aa9bc94de0aa334380b3903dd2f5ec1f48231 (diff)
downloadlinux-0b5390aeaa85eb2f15e0e2ea0731c0995285db5e.tar.gz
linux-0b5390aeaa85eb2f15e0e2ea0731c0995285db5e.tar.bz2
linux-0b5390aeaa85eb2f15e0e2ea0731c0995285db5e.zip
md/md-bitmap: fix stats collection for external bitmaps
[ Upstream commit 6ec1f0239485028445d213d91cfee5242f3211ba ] The bitmap_get_stats() function incorrectly returns -ENOENT for external bitmaps. Remove the external bitmap check as the statistics should be available regardless of bitmap storage location. Return -EINVAL only for invalid bitmap with no storage (neither in superblock nor in external file). Note: "bitmap_info.external" here refers to a bitmap stored in a separate file (bitmap_file), not to external metadata. Fixes: 8d28d0ddb986 ("md/md-bitmap: Synchronize bitmap_get_stats() with bitmap lifetime") Signed-off-by: Zheng Qixing <zhengqixing@huawei.com> Link: https://lore.kernel.org/linux-raid/20250403015322.2873369-1-zhengqixing@huaweicloud.com Signed-off-by: Yu Kuai <yukuai3@huawei.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md-bitmap.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
index deb40a8ba399..8317e07b326d 100644
--- a/drivers/md/md-bitmap.c
+++ b/drivers/md/md-bitmap.c
@@ -2119,9 +2119,8 @@ int md_bitmap_get_stats(struct bitmap *bitmap, struct md_bitmap_stats *stats)
if (!bitmap)
return -ENOENT;
- if (bitmap->mddev->bitmap_info.external)
- return -ENOENT;
- if (!bitmap->storage.sb_page) /* no superblock */
+ if (!bitmap->mddev->bitmap_info.external &&
+ !bitmap->storage.sb_page)
return -EINVAL;
sb = kmap_local_page(bitmap->storage.sb_page);
stats->sync_size = le64_to_cpu(sb->sync_size);