From: Radoslaw Zarzynski Date: Thu, 19 Mar 2015 13:52:18 +0000 (+0100) Subject: rgw: rectify 202 Accepted in response for PUT on existing bucket. X-Git-Tag: v9.0.0~146^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3998fe7e02a6c25a3302c80a9c9907357fd3a23e;p=ceph.git rgw: rectify 202 Accepted in response for PUT on existing bucket. Fixes: #11148 Backport: hammer Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index b2dd7c2d7f61..04ed4b5af450 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -1409,10 +1409,11 @@ void RGWCreateBucket::execute() /* bucket already existed, might have raced with another bucket creation, or * might be partial bucket creation that never completed. Read existing bucket * info, verify that the reported bucket owner is the current user. - * If all is ok then update the user's list of buckets + * If all is ok then update the user's list of buckets. + * Otherwise inform client about a name conflict. */ if (info.owner.compare(s->user.user_id) != 0) { - ret = -ERR_BUCKET_EXISTS; + ret = -EEXIST; return; } s->bucket = info.bucket; @@ -1424,10 +1425,9 @@ void RGWCreateBucket::execute() if (ret < 0) { ldout(s->cct, 0) << "WARNING: failed to unlink bucket: ret=" << ret << dendl; } - } - - if (ret == -EEXIST) + } else if (ret == -EEXIST || (ret == 0 && existed)) { ret = -ERR_BUCKET_EXISTS; + } } int RGWDeleteBucket::verify_permission()