From: Casey Bodley Date: Wed, 8 Jan 2025 21:48:24 +0000 (-0500) Subject: rgw: improved error when listing indexless bucket X-Git-Tag: v20.0.0~43^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=fa4c5cebd2b611c20b0fc9da122b138900cb571b;p=ceph.git rgw: improved error when listing indexless bucket without this change, ListObjects would attempt to list index shard objects that don't exist and fail with: > ERROR: S3 error: 404 (NoSuchKey) after: > ERROR: S3 error: 405 (MethodNotAllowed): Indexless buckets cannot be listed Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 0095395237c96..e5eaf4805a940 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -3196,6 +3196,13 @@ void RGWListBucket::execute(optional_yield y) return; } + if (const auto& current_index = s->bucket->get_info().layout.current_index; + current_index.layout.type == rgw::BucketIndexType::Indexless) { + s->err.message = "Indexless buckets cannot be listed"; + op_ret = -ERR_METHOD_NOT_ALLOWED; + return; + } + if (allow_unordered && !delimiter.empty()) { ldpp_dout(this, 0) << "ERROR: unordered bucket listing requested with a delimiter" << dendl;