]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Handle stale bucket info in RGWDeleteBucketPolicy
authorAdam C. Emerson <aemerson@redhat.com>
Fri, 17 Nov 2017 21:16:38 +0000 (16:16 -0500)
committerAdam C. Emerson <aemerson@redhat.com>
Mon, 27 Nov 2017 20:57:15 +0000 (15:57 -0500)
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/rgw/rgw_op.cc

index aa62e40f24a45fd7b205dabd810d58cac52167b0..95aec1ba175a0af4116e5a7f84f6565b62bb4c5a 100644 (file)
@@ -6955,11 +6955,11 @@ int RGWDeleteBucketPolicy::verify_permission()
 
 void RGWDeleteBucketPolicy::execute()
 {
-  auto attrs = s->bucket_attrs;
-  attrs.erase(RGW_ATTR_IAM_POLICY);
-  op_ret = rgw_bucket_set_attrs(store, s->bucket_info, attrs,
-                               &s->bucket_info.objv_tracker);
-  if (op_ret == -ECANCELED) {
-    op_ret = 0; /* lost a race, but it's ok because policies are immutable */
-  }
+  op_ret = retry_raced_bucket_write(store, s, [this] {
+      auto attrs = s->bucket_attrs;
+      attrs.erase(RGW_ATTR_IAM_POLICY);
+      op_ret = rgw_bucket_set_attrs(store, s->bucket_info, attrs,
+                                   &s->bucket_info.objv_tracker);
+      return op_ret;
+    });
 }