From 218932a9a87c5d1f2559aaa7bf7928cd7a243194 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Thu, 10 Sep 2020 15:37:18 -0400 Subject: [PATCH] rgw: RGWCreateBucket uses s->bucket_exists instead of EEXIST 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 --- src/rgw/rgw_op.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index fd04060ca2ff5..e2949e329adac 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -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 -- 2.39.5