]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson: abort on ioctl(BLKGETNRZONES) failure
authorKefu Chai <k.chai@proxmox.com>
Mon, 11 May 2026 05:27:42 +0000 (13:27 +0800)
committerKefu Chai <k.chai@proxmox.com>
Tue, 12 May 2026 03:03:03 +0000 (11:03 +0800)
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 <k.chai@proxmox.com>
src/crimson/os/seastore/segment_manager.cc

index 1252cc3859733c295f6d976d7cf41fd652061883..90a95be0a4308eeecf6bb961e552ab30cbde713d 100644 (file)
@@ -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<segment_manager::zbd::ZBDSegmentManager>(device + "/block");