From: Casey Bodley Date: Wed, 25 Mar 2026 20:17:01 +0000 (-0400) Subject: rgw/iam: User/Group/Role apis map ECANCELED to ERR_CONCURRENT_MODIFICATION X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c36fea4757989c5757644e9e0ed86e333409322a;p=ceph.git rgw/iam: User/Group/Role apis map ECANCELED to ERR_CONCURRENT_MODIFICATION 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 --- diff --git a/src/rgw/rgw_common.cc b/src/rgw/rgw_common.cc index faf80be64bc1..1fc3c6c6bd1e 100644 --- a/src/rgw/rgw_common.cc +++ b/src/rgw/rgw_common.cc @@ -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"}}, diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 8f95f4ef6716..462c90c638c2 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -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 diff --git a/src/rgw/rgw_rest_iam.h b/src/rgw/rgw_rest_iam.h index 3c017539d9ce..ef3306e67117 100644 --- a/src/rgw/rgw_rest_iam.h +++ b/src/rgw/rgw_rest_iam.h @@ -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; }