From 0de02a88be0972c89ed2bb10dc438d080137bd18 Mon Sep 17 00:00:00 2001 From: Nikhil Kshirsagar Date: Fri, 1 Oct 2021 10:19:00 +0530 Subject: [PATCH] rgw: clear buckets before calling list_buckets() The ragodgw-admin bucket limit check command has a bug in octopus. Since we do not clear the bucket list before list_buckets() returns the next max_entries, they are appended to the existing list and we end up counting the first ones again. This bug is triggered if bucket count exceeds max_entries and causes duplicates in the output of radosgw-admin bucket limit check. The fix clears the buckets structure before the list_buckets() populates it again with the next lot of buckets to iterate through. partial manual cherry-pick of 99f7c4aa1286edfea6961b92bb44bb8fe22bd599 Signed-off-by: Nikhil Kshirsagar --- src/rgw/rgw_sal.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rgw/rgw_sal.cc b/src/rgw/rgw_sal.cc index 2b7a313ed9120..65880a4757ff8 100644 --- a/src/rgw/rgw_sal.cc +++ b/src/rgw/rgw_sal.cc @@ -35,6 +35,7 @@ int RGWRadosUser::list_buckets(const string& marker, const string& end_marker, RGWUserBuckets ulist; bool is_truncated = false; int ret; + buckets.clear(); ret = store->ctl()->user->list_buckets(info.user_id, marker, end_marker, max, need_stats, &ulist, &is_truncated); -- 2.39.5