]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: RGWCreateBucket uses s->bucket_exists instead of EEXIST
authorCasey Bodley <cbodley@redhat.com>
Thu, 10 Sep 2020 19:37:18 +0000 (15:37 -0400)
committerCasey Bodley <cbodley@redhat.com>
Thu, 10 Sep 2020 19:37:21 +0000 (15:37 -0400)
RGWStore::create_bucket() only returns EEXIST in case of conflicts that
should be returned to the client as errors. the code that applies
changes to metadata should instead use the s->bucket_exists flag

Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_op.cc

index fd04060ca2ff534b9d7b2e82d20b728bc0c6d91b..e2949e329adacb9967660f0d0cbf048ecb145b39 100644 (file)
@@ -3046,7 +3046,6 @@ void RGWCreateBucket::execute()
 {
   buffer::list aclbl;
   buffer::list corsbl;
-  bool existed;
   string bucket_name = rgw_make_bucket_entry_name(s->bucket_tenant, s->bucket_name);
   rgw_raw_obj obj(store->svc()->zone->get_zone_params().domain_root, bucket_name);
 
@@ -3169,11 +3168,10 @@ void RGWCreateBucket::execute()
    * recover from a partial create by retrying it. */
   ldpp_dout(this, 20) << "rgw_create_bucket returned ret=" << op_ret << " bucket=" << s->bucket.get() << dendl;
 
-  if (op_ret && op_ret != -EEXIST)
+  if (op_ret)
     return;
 
-  existed = (op_ret == -EEXIST);
-
+  const bool existed = s->bucket_exists;
   if (existed) {
     /* bucket already existed, might have raced with another bucket creation, or
      * might be partial bucket creation that never completed. Read existing bucket