From fa4c5cebd2b611c20b0fc9da122b138900cb571b Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Wed, 8 Jan 2025 16:48:24 -0500 Subject: [PATCH] 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 --- src/rgw/rgw_op.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 0095395237c..e5eaf4805a9 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; -- 2.39.5