]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fail as expected when set/delete-bucket-website attempted on a non-existent... 42195/head
authormengxiangrui <mengxr@chinatelecom.cn>
Tue, 6 Jul 2021 11:58:55 +0000 (19:58 +0800)
committermengxiangrui <mengxr@chinatelecom.cn>
Wed, 7 Jul 2021 06:02:51 +0000 (14:02 +0800)
Fixes: https://tracker.ceph.com/issues/51536
Signed-off-by: xiangrui meng <mengxr@chinatelecom.cn>
src/rgw/rgw_op.cc

index e89ae9732e23240bbd0832a1f899b329441316f5..cef7f945932da84379250195c30c951cc43ddf18 100644 (file)
@@ -2669,6 +2669,11 @@ void RGWSetBucketWebsite::execute(optional_yield y)
   if (op_ret < 0)
     return;
 
+  if (!s->bucket_exists) {
+    op_ret = -ERR_NO_SUCH_BUCKET;
+    return;
+  }
+
   op_ret = store->forward_request_to_master(this, s->user.get(), nullptr, in_data, nullptr, s->info, y);
   if (op_ret < 0) {
     ldpp_dout(this, 0) << " forward_request_to_master returned ret=" << op_ret << dendl;
@@ -2701,6 +2706,11 @@ void RGWDeleteBucketWebsite::pre_exec()
 
 void RGWDeleteBucketWebsite::execute(optional_yield y)
 {
+  if (!s->bucket_exists) {
+    op_ret = -ERR_NO_SUCH_BUCKET;
+    return;
+  }
+
   bufferlist in_data;
 
   op_ret = store->forward_request_to_master(this, s->user.get(), nullptr, in_data, nullptr, s->info, y);