From 78cd82b6e9f36a91f47d44ad2cfae89add335d4c Mon Sep 17 00:00:00 2001 From: shreyanshjain7174 Date: Mon, 11 Sep 2023 06:40:33 -0400 Subject: [PATCH] RadosGW API: incorrect bucket quota in response to HEAD /{bucket}/?usage When we try to get the bucket usage via various methods, through curl or while accessing rgw api endpoint at HEAD /{bucket}/?usage doesn't return the updated information. The endpoint was always returning the user quota and not the actual bucket quota which we see after querying the endpoint. Fixes: https://tracker.ceph.com/issues/62737 Signed-off-by: shreyanshjain7174 --- src/rgw/rgw_rest_s3.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index 472b479994c63..578ab46ed40d7 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -2345,11 +2345,12 @@ static void dump_bucket_metadata(req_state *s, rgw::sal::Bucket* bucket) // only bucket's owner is allowed to get the quota settings of the account if (bucket->is_owner(s->user.get())) { auto user_info = s->user->get_info(); + auto bucket_quota = s->bucket->get_info().quota; // bucket quota dump_header(s, "X-RGW-Quota-User-Size", static_cast(user_info.quota.user_quota.max_size)); dump_header(s, "X-RGW-Quota-User-Objects", static_cast(user_info.quota.user_quota.max_objects)); dump_header(s, "X-RGW-Quota-Max-Buckets", static_cast(user_info.max_buckets)); - dump_header(s, "X-RGW-Quota-Bucket-Size", static_cast(user_info.quota.bucket_quota.max_size)); - dump_header(s, "X-RGW-Quota-Bucket-Objects", static_cast(user_info.quota.bucket_quota.max_objects)); + dump_header(s, "X-RGW-Quota-Bucket-Size", static_cast(bucket_quota.max_size)); + dump_header(s, "X-RGW-Quota-Bucket-Objects", static_cast(bucket_quota.max_objects)); } } -- 2.39.5