]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix UploadPartCopy error code when src object not exist and src bucket not exist 53356/head
authoryuliyang <yuliyang_yewu@cmss.chinamobile.com>
Fri, 5 Nov 2021 07:40:44 +0000 (08:40 +0100)
committerKonstantin Shalygin <k0ste@k0ste.ru>
Sun, 10 Sep 2023 08:22:23 +0000 (15:22 +0700)
fix https://tracker.ceph.com/issues/53181

Signed-off-by: yuliyang <yuliyang_yewu@cmss.chinamobile.com>
(cherry picked from commit 0804104ec01cd6acb57fd5c764bf1cfa47ff9a16)

src/rgw/rgw_op.cc

index e2d74d9cedd7257534e3e250dd4883f25e48578f..1ecab3171d75041ebe4e8033d5dc62346e61a950 100644 (file)
@@ -450,10 +450,10 @@ static int read_obj_policy(const DoutPrefixProvider *dpp,
                            map<string, bufferlist>& bucket_attrs,
                            RGWAccessControlPolicy* acl,
                            string *storage_class,
-                          boost::optional<Policy>& policy,
+                           boost::optional<Policy>& policy,
                            rgw::sal::RGWBucket* bucket,
                            rgw::sal::RGWObject* object,
-                          optional_yield y,
+                           optional_yield y,
                            bool copy_src=false)
 {
   string upload_id;
@@ -3578,6 +3578,9 @@ int RGWPutObj::init_processing(optional_yield y) {
                              &bucket, y);
     if (ret < 0) {
       ldpp_dout(this, 5) << __func__ << "(): get_bucket() returned ret=" << ret << dendl;
+      if (ret == -ENOENT) {
+        ret = -ERR_NO_SUCH_BUCKET;
+      }
       return ret;
     }
 
@@ -3645,9 +3648,9 @@ int RGWPutObj::verify_permission(optional_yield y)
     cs_object->set_prefetch_data(s->obj_ctx);
 
     /* check source object permissions */
-    if (read_obj_policy(this, store, s, copy_source_bucket_info, cs_attrs, &cs_acl, nullptr,
-                       policy, cs_bucket.get(), cs_object.get(), y, true) < 0) {
-      return -EACCES;
+    if (ret = read_obj_policy(this, store, s, copy_source_bucket_info, cs_attrs, &cs_acl, nullptr,
+                       policy, cs_bucket.get(), cs_object.get(), y, true); ret < 0) {
+      return ret;
     }
 
     /* admin request overrides permission checks */