From 86b855141afa0fd6d82b9929ee0bb10f70ae2d50 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Mon, 4 Dec 2023 16:34:12 -0500 Subject: [PATCH] rgw/rados: rgw_list_pool() loops until 'max' matches instead of looping up to 'max' oids, continue looping until the filter actually matches 'max' entries Signed-off-by: Casey Bodley --- src/rgw/driver/rados/rgw_tools.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/rgw/driver/rados/rgw_tools.cc b/src/rgw/driver/rados/rgw_tools.cc index bf78b9bb22e2..269c790e401e 100644 --- a/src/rgw/driver/rados/rgw_tools.cc +++ b/src/rgw/driver/rados/rgw_tools.cc @@ -517,9 +517,7 @@ int rgw_list_pool(const DoutPrefixProvider *dpp, if (iter == ioctx.nobjects_end()) return -ENOENT; - uint32_t i; - - for (i = 0; i < max && iter != ioctx.nobjects_end(); ++i, ++iter) { + for (; oids->size() < max && iter != ioctx.nobjects_end(); ++iter) { string oid = iter->get_oid(); ldpp_dout(dpp, 20) << "RGWRados::pool_iterate: got " << oid << dendl; -- 2.47.3