]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: rectify 202 Accepted in response for PUT on existing bucket. 5214/head
authorRadoslaw Zarzynski <rzarzynski@mirantis.com>
Thu, 19 Mar 2015 13:52:18 +0000 (14:52 +0100)
committerNathan Cutler <ncutler@suse.com>
Mon, 13 Jul 2015 14:37:42 +0000 (16:37 +0200)
Fixes: #11148
Backport: hammer
Signed-off-by: Radoslaw Zarzynski <rzarzynski@mirantis.com>
(cherry picked from commit 3998fe7e02a6c25a3302c80a9c9907357fd3a23e)

src/rgw/rgw_op.cc

index d2804e57343408795e1174d0a01555b3f45e5187..bf6c3e7fd08485c25a441aaa835c8e0fc32dc424 100644 (file)
@@ -1399,10 +1399,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;
@@ -1414,10 +1415,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()