From 481dfb15e4675eecacae401500a8e5c555948314 Mon Sep 17 00:00:00 2001 From: Jaya Prakash Date: Wed, 26 Feb 2025 19:32:59 +0530 Subject: [PATCH] blk/kernel : skip AIO thread for zero-sized devices Sometimes devices can be 0-sized, where I/O is impossible. This change skips _aio_start() in open() if the device size is 0. This avoids unnecessary AIO setup. This issue was introduced in PR : https://github.com/ceph/ceph/pull/60791 Signed-off-by: Jaya Prakash --- src/blk/kernel/KernelDevice.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/blk/kernel/KernelDevice.cc b/src/blk/kernel/KernelDevice.cc index 41f0608355ddd..c4e6168a61dda 100644 --- a/src/blk/kernel/KernelDevice.cc +++ b/src/blk/kernel/KernelDevice.cc @@ -295,9 +295,13 @@ int KernelDevice::open(const string& p) goto out_fail; } - r = _aio_start(); - if (r < 0) { - goto out_fail; + if (size > 0) { + r = _aio_start(); + if (r < 0) { + goto out_fail; + } + } else { + aio = false; } _discard_update_threads(); -- 2.39.5