From: Nikhil Kshirsagar Date: Fri, 1 Oct 2021 04:49:00 +0000 (+0530) Subject: rgw: clear buckets before calling list_buckets() X-Git-Tag: v15.2.16~79^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F43381%2Fhead;p=ceph.git 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 --- diff --git a/src/rgw/rgw_sal.cc b/src/rgw/rgw_sal.cc index 2b7a313ed912..65880a4757ff 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);