]> 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 43817/head
authoryuliyang <yuliyang_yewu@cmss.chinamobile.com>
Fri, 5 Nov 2021 07:40:44 +0000 (08:40 +0100)
committeryuliyang <yuliyang_yewu@cmss.chinamobile.com>
Sat, 6 Nov 2021 07:54:25 +0000 (08:54 +0100)
fix https://tracker.ceph.com/issues/53181

Signed-off-by: yuliyang <yuliyang_yewu@cmss.chinamobile.com>
src/rgw/rgw_op.cc

index f295fb92d57617557559dea75a3d715026ec1349..1f057cefa5d0944860351247260651647274135d 100644 (file)
@@ -367,10 +367,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::Bucket* bucket,
                            rgw::sal::Object* object,
-                          optional_yield y,
+                           optional_yield y,
                            bool copy_src=false)
 {
   string upload_id;
@@ -3489,6 +3489,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;
     }
 
@@ -3556,9 +3559,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 */