]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: improved error when listing indexless bucket
authorCasey Bodley <cbodley@redhat.com>
Wed, 8 Jan 2025 21:48:24 +0000 (16:48 -0500)
committerCasey Bodley <cbodley@redhat.com>
Tue, 25 Feb 2025 16:15:57 +0000 (11:15 -0500)
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 <cbodley@redhat.com>
src/rgw/rgw_op.cc

index 0095395237c9627d818f1e2c8e3ec8bbde3c3da4..e5eaf4805a940057ae7569216fa7b9884e44caba 100644 (file)
@@ -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;