From f9acf620bb20f313a4a4dbca6f22fe3306ffc0be Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Mon, 11 May 2026 13:27:42 +0800 Subject: [PATCH] crimson: abort on ioctl(BLKGETNRZONES) failure previously, we did not check the return value of ioctl(BLKGETNRZONES). we query the number of zones of the storage device to determine which seastore backend to use. the only possible error from this ioctl is -EFAULT (invalid user pointer), which indicates a programming error and should never happen in practice. use ceph_assert() to catch this. Signed-off-by: Kefu Chai --- src/crimson/os/seastore/segment_manager.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/crimson/os/seastore/segment_manager.cc b/src/crimson/os/seastore/segment_manager.cc index 1252cc385973..90a95be0a430 100644 --- a/src/crimson/os/seastore/segment_manager.cc +++ b/src/crimson/os/seastore/segment_manager.cc @@ -39,7 +39,8 @@ SegmentManager::get_segment_manager( seastar::open_flags::rw); ceph_assert(file); uint32_t nr_zones = 0; - [[maybe_unused]] auto ret = co_await file.ioctl(BLKGETNRZONES, &nr_zones); + auto ret = co_await file.ioctl(BLKGETNRZONES, &nr_zones); + ceph_assert(ret == 0); INFO("Found {} zones.", nr_zones); if (nr_zones != 0) { co_return std::make_unique(device + "/block"); -- 2.47.3