]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/iam: User/Group/Role apis map ECANCELED to ERR_CONCURRENT_MODIFICATION 68007/head
authorCasey Bodley <cbodley@redhat.com>
Wed, 25 Mar 2026 20:17:01 +0000 (16:17 -0400)
committerCasey Bodley <cbodley@redhat.com>
Wed, 25 Mar 2026 20:27:09 +0000 (16:27 -0400)
avoid mapping generic ECANCELED errors to 409 by introducing a new
ERR_CONCURRENT_MODIFICATION specifically for this mapping. other
ECANCELED will default back to 500 UnknownError as they did prior to
a9c49a5ce7a2eb74e50cde11f6a8aab32764aa89

for iam apis, retry helper functions retry_raced_user_write() etc.
map the resulting ECANCELED errors to ERR_CONCURRENT_MODIFICATION
after exhausting the retry counter

https://docs.aws.amazon.com/IAM/latest/APIReference/API_Operations.html
isn't very consistent about which of its actions are allowed to return
ConcurrentModification. rgw may return this for any metadata writes
that are protected by cls_version but are not exclusive creates

Fixes: https://tracker.ceph.com/issues/75722
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_common.cc
src/rgw/rgw_common.h
src/rgw/rgw_rest_iam.h

index faf80be64bc149ca056cb8376602301d45d52abe..1fc3c6c6bd1e46943854a414b365bce733ca3d3f 100644 (file)
@@ -139,7 +139,7 @@ rgw_http_errors rgw_http_s3_errors({
     { ERR_NO_SUCH_PUBLIC_ACCESS_BLOCK_CONFIGURATION, {404, "NoSuchPublicAccessBlockConfiguration"}},
     { ERR_ACCOUNT_EXISTS, {409, "AccountAlreadyExists"}},
     { ERR_RESTORE_ALREADY_IN_PROGRESS, {409, "RestoreAlreadyInProgress"}},
-    { ECANCELED, {409, "ConcurrentModification"}},
+    { ERR_CONCURRENT_MODIFICATION, {409, "ConcurrentModification"}},
     { EDQUOT, {507, "InsufficientCapacity"}},
     { ENOSPC, {507, "InsufficientCapacity"}},
     { ERR_ACLS_NOT_SUPPORTED, {400, "AccessControlListNotSupported"}},
index 8f95f4ef6716971ba1228754ca6569231817c09b..462c90c638c23bec1492d49caf4ca2148dba57a0 100644 (file)
@@ -359,6 +359,7 @@ inline constexpr const char* RGW_REST_STS_XMLNS =
 #define ERR_BUSY_RESHARDING      2300 // also in cls_rgw_types.h, don't change!
 #define ERR_NO_SUCH_ENTITY       2301
 #define ERR_LIMIT_EXCEEDED       2302
+#define ERR_CONCURRENT_MODIFICATION 2303
 
 // STS Errors
 #define ERR_PACKED_POLICY_TOO_LARGE 2400
index 3c017539d9cedf1d8d60249a82e4c203a0bbf9e9..ef3306e671174dbbeadca03ca4edf2593595b2c6 100644 (file)
@@ -50,6 +50,10 @@ int retry_raced_user_write(const DoutPrefixProvider* dpp, optional_yield y,
       r = f();
     }
   }
+  if (r == -ECANCELED) {
+    // map ECANCELED to 409 ConcurrentModification
+    return -ERR_CONCURRENT_MODIFICATION;
+  }
   return r;
 }
 
@@ -70,6 +74,10 @@ int retry_raced_group_write(const DoutPrefixProvider* dpp, optional_yield y,
       r = f();
     }
   }
+  if (r == -ECANCELED) {
+    // map ECANCELED to 409 ConcurrentModification
+    return -ERR_CONCURRENT_MODIFICATION;
+  }
   return r;
 }
 
@@ -88,6 +96,10 @@ int retry_raced_role_write(const DoutPrefixProvider* dpp, optional_yield y,
       r = f();
     }
   }
+  if (r == -ECANCELED) {
+    // map ECANCELED to 409 ConcurrentModification
+    return -ERR_CONCURRENT_MODIFICATION;
+  }
   return r;
 }