From e81400b8c287b5c5a61ddf946c188c2b9e66dd2f Mon Sep 17 00:00:00 2001 From: hzwuhongsong Date: Tue, 29 Dec 2020 14:24:01 +0800 Subject: [PATCH] blk: add upper bound of bluestore_deferred_batch_ops* options so the number of pending io does not overflow when being passed to submit_batch(). Signed-off-by: hzwuhongsong --- src/blk/kernel/KernelDevice.cc | 3 +++ src/common/options.cc | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/blk/kernel/KernelDevice.cc b/src/blk/kernel/KernelDevice.cc index e3ef9f155d8..d9327996597 100644 --- a/src/blk/kernel/KernelDevice.cc +++ b/src/blk/kernel/KernelDevice.cc @@ -12,6 +12,7 @@ * */ +#include #include #include #include @@ -813,6 +814,8 @@ void KernelDevice::aio_submit(IOContext *ioc) void *priv = static_cast(ioc); int r, retries = 0; + // num of pending aios should not overflow when passed to submit_batch() + assert(pending <= std::numeric_limits::max()); r = io_queue->submit_batch(ioc->running_aios.begin(), e, pending, priv, &retries); diff --git a/src/common/options.cc b/src/common/options.cc index 57901687e77..7590e0f8f13 100644 --- a/src/common/options.cc +++ b/src/common/options.cc @@ -4617,17 +4617,20 @@ std::vector