]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: CompleteMultipartUpload can fail with 404 NoSuchUpload 68186/head
authorCasey Bodley <cbodley@redhat.com>
Thu, 2 Apr 2026 16:15:51 +0000 (12:15 -0400)
committerCasey Bodley <cbodley@redhat.com>
Thu, 2 Apr 2026 16:15:53 +0000 (12:15 -0400)
prior work in 324c377849a5d246f689f6e7a2862f42f1504d2c made the request
idempotent in cases where ENOENT indicated the upload had already
completed, but other ENOENT cases still returned 500. fall back to 404
NoSuchUpload here instead

Fixes: https://tracker.ceph.com/issues/75534
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_op.cc

index bd3cfe2a4e2d60b8f198d4d033b2761140cc8125..b88752f3fce74e6312c4bc209b093711d1ebfc24 100644 (file)
@@ -7436,13 +7436,22 @@ void RGWCompleteMultipart::execute(optional_yield y)
 
   serializer = meta_obj->get_serializer(this, y, "RGWCompleteMultipart");
   op_ret = serializer->try_lock(this, dur, y);
-  if (op_ret < 0) {
-    ldpp_dout(this, 0) << "failed to acquire lock" << dendl;
-    if (op_ret == -ENOENT && check_previously_completed(parts)) {
-      ldpp_dout(this, 1) << "NOTICE: This multipart completion is already completed" << dendl;
+  if (op_ret == -ENOENT) {
+    // CompleteMultipartUpload should be idempotent - return success if the
+    // upload already completed. but note that this check isn't reliable in
+    // cases where the upload completed successfully but was later overwritten
+    // or deleted
+    if (check_previously_completed(parts)) {
+      ldpp_dout(this, 4) << "NOTICE: This multipart completion is already completed" << dendl;
       op_ret = 0;
       return;
     }
+    s->err.message = "The specified multipart upload does not exist.";
+    op_ret = -ERR_NO_SUCH_UPLOAD;
+    return;
+  }
+  if (op_ret < 0) {
+    ldpp_dout(this, 0) << "failed to acquire lock" << dendl;
     op_ret = -ERR_INTERNAL_ERROR;
     s->err.message = "This multipart completion is already in progress";
     return;