]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/sal: User::remove_bucket() no longer supports forward_to_master
authorCasey Bodley <cbodley@redhat.com>
Tue, 26 Jul 2022 16:49:55 +0000 (12:49 -0400)
committerCasey Bodley <cbodley@redhat.com>
Mon, 6 Nov 2023 16:07:23 +0000 (11:07 -0500)
callers of remove_bucket() are now responsible for calling
forward_request_to_master() themselves

Signed-off-by: Casey Bodley <cbodley@redhat.com>
17 files changed:
src/rgw/driver/daos/rgw_sal_daos.cc
src/rgw/driver/daos/rgw_sal_daos.h
src/rgw/driver/motr/rgw_sal_motr.cc
src/rgw/driver/motr/rgw_sal_motr.h
src/rgw/driver/posix/rgw_sal_posix.cc
src/rgw/driver/posix/rgw_sal_posix.h
src/rgw/driver/rados/rgw_bucket.cc
src/rgw/driver/rados/rgw_rest_bucket.cc
src/rgw/driver/rados/rgw_sal_rados.cc
src/rgw/driver/rados/rgw_sal_rados.h
src/rgw/driver/rados/rgw_user.cc
src/rgw/rgw_op.cc
src/rgw/rgw_sal.h
src/rgw/rgw_sal_dbstore.cc
src/rgw/rgw_sal_dbstore.h
src/rgw/rgw_sal_filter.cc
src/rgw/rgw_sal_filter.h

index 73eec5b3e09c159ef0429d1eec7eb7c60784464e..c4deba7f11f999687c9d696507594c75f3cab27c 100644 (file)
@@ -405,13 +405,9 @@ std::unique_ptr<struct ds3_bucket_info> DaosBucket::get_encoded_info(
 }
 
 int DaosBucket::remove_bucket(const DoutPrefixProvider* dpp,
-                              bool delete_children, bool forward_to_master,
-                              req_info* req_info, optional_yield y) {
+                              bool delete_children, optional_yield y) {
   ldpp_dout(dpp, 20) << "DEBUG: remove_bucket, delete_children="
-                    
-                     << delete_children
-                    
-                     << " forward_to_master=" << forward_to_master << dendl;
+                     << delete_children << dendl;
 
   return ds3_bucket_destroy(get_name().c_str(), delete_children, store->ds3,
                             nullptr);
index 429c6160488d8c7ffc2f17749fb8e755949705ba..84b640b8a6e0f2460307f272faa4dd2fca4c3d86 100644 (file)
@@ -290,7 +290,6 @@ class DaosBucket : public StoreBucket {
   virtual int list(const DoutPrefixProvider* dpp, ListParams&, int,
                    ListResults&, optional_yield y) override;
   virtual int remove_bucket(const DoutPrefixProvider* dpp, bool delete_children,
-                            bool forward_to_master, req_info* req_info,
                             optional_yield y) override;
   virtual int remove_bucket_bypass_gc(int concurrent_max,
                                       bool keep_index_consistent,
index 83c6153a92a597ac79694a3631637f8b7bec5a47..e9377f945360a8d51af43a583f71e06b1096fc19 100644 (file)
@@ -556,7 +556,7 @@ int MotrUser::verify_mfa(const std::string& mfa_str, bool* verified, const DoutP
   return 0;
 }
 
-int MotrBucket::remove_bucket(const DoutPrefixProvider *dpp, bool delete_children, bool forward_to_master, req_info* req_info, optional_yield y)
+int MotrBucket::remove_bucket(const DoutPrefixProvider *dpp, bool delete_children, optional_yield y)
 {
   int ret;
 
index ce5fc2b95b1f5bc26f45063feb61ebcecc63bc17..6e6b9908061f38944f7b6266e79f78dc69bf6ee5 100644 (file)
@@ -352,7 +352,7 @@ class MotrBucket : public StoreBucket {
 
     virtual std::unique_ptr<Object> get_object(const rgw_obj_key& k) override;
     virtual int list(const DoutPrefixProvider *dpp, ListParams&, int, ListResults&, optional_yield y) override;
-    virtual int remove_bucket(const DoutPrefixProvider *dpp, bool delete_children, bool forward_to_master, req_info* req_info, optional_yield y) override;
+    virtual int remove_bucket(const DoutPrefixProvider *dpp, bool delete_children, optional_yield y) override;
     virtual int remove_bucket_bypass_gc(int concurrent_max, bool
         keep_index_consistent,
         optional_yield y, const
index 40091d06d0f991e56eeb1c12e2bca1afa0c5d128..b999839bf4e78b18ae68c6fc50361b66bc22e5eb 100644 (file)
@@ -950,8 +950,6 @@ int POSIXBucket::merge_and_store_attrs(const DoutPrefixProvider* dpp,
 
 int POSIXBucket::remove_bucket(const DoutPrefixProvider* dpp,
                                bool delete_children,
-                               bool forward_to_master,
-                               req_info* req_info,
                                optional_yield y)
 {
   return delete_directory(parent_fd, get_fname().c_str(),
@@ -963,7 +961,7 @@ int POSIXBucket::remove_bucket_bypass_gc(int concurrent_max,
                                         optional_yield y,
                                         const DoutPrefixProvider *dpp)
 {
-  return remove_bucket(dpp, true, false, nullptr, y);
+  return remove_bucket(dpp, true, y);
 }
 
 int POSIXBucket::load_bucket(const DoutPrefixProvider* dpp, optional_yield y)
@@ -1547,7 +1545,7 @@ int POSIXObject::delete_object(const DoutPrefixProvider* dpp,
 
   if (!b->versioned()) {
     if (shadow) {
-      ret = shadow->remove_bucket(dpp, true, false, nullptr, y);
+      ret = shadow->remove_bucket(dpp, true, y);
       if (ret < 0) {
        return ret;
       }
@@ -2686,7 +2684,7 @@ int POSIXMultipartUpload::abort(const DoutPrefixProvider *dpp, CephContext *cct,
     return ret;
   }
 
-  shadow->remove_bucket(dpp, true, false, nullptr, y);
+  shadow->remove_bucket(dpp, true, y);
 
   return 0;
 }
index 739e7ef7a610b2a84d492025a2a5a0e645462b23..3695763c45f9d960166903f056c5d7ea1bb10a3d 100644 (file)
@@ -196,7 +196,6 @@ public:
   virtual int merge_and_store_attrs(const DoutPrefixProvider* dpp,
                                    Attrs& new_attrs, optional_yield y) override;
   virtual int remove_bucket(const DoutPrefixProvider* dpp, bool delete_children,
-                           bool forward_to_master, req_info* req_info,
                            optional_yield y) override;
   virtual int remove_bucket_bypass_gc(int concurrent_max,
                                      bool keep_index_consistent,
index fc16316efa4c1efe33a05937d01eb4feb8006f3d..04fa15381390480d82fe14f5bb692db72199a740 100644 (file)
@@ -1250,8 +1250,7 @@ int RGWBucketAdminOp::remove_bucket(rgw::sal::Driver* driver, RGWBucketAdminOpSt
   if (bypass_gc)
     ret = bucket->remove_bucket_bypass_gc(op_state.get_max_aio(), keep_index_consistent, y, dpp);
   else
-    ret = bucket->remove_bucket(dpp, op_state.will_delete_children(),
-                               false, nullptr, y);
+    ret = bucket->remove_bucket(dpp, op_state.will_delete_children(), y);
 
   return ret;
 }
index 69e3f42f15e23338619002537d2036de70bb3712..9c811efa42d7a3087021340812282f2e0d03b026 100644 (file)
@@ -220,9 +220,19 @@ void RGWOp_Bucket_Remove::execute(optional_yield y)
   RESTArgs::get_string(s, "bucket", bucket_name, &bucket_name);
   RESTArgs::get_bool(s, "purge-objects", false, &delete_children);
 
-  /* FIXME We're abusing the owner of the bucket to pass the user, so that it can be forwarded to
-   * the master.  This user is actually the OP caller, not the bucket owner. */
-  op_ret = driver->get_bucket(s, s->user.get(), string(), bucket_name, &bucket, y);
+  bufferlist data;
+  op_ret = driver->forward_request_to_master(s, s->user.get(), nullptr, data, nullptr, s->info, y);
+  if (op_ret < 0) {
+    ldpp_dout(this, 0) << "forward_request_to_master returned ret=" << op_ret << dendl;
+    if (op_ret == -ENOENT) {
+      /* adjust error, we want to return with NoSuchBucket and not
+       * NoSuchKey */
+      op_ret = -ERR_NO_SUCH_BUCKET;
+    }
+    return;
+  }
+
+  op_ret = driver->get_bucket(s, nullptr, string(), bucket_name, &bucket, y);
   if (op_ret < 0) {
     ldpp_dout(this, 0) << "get_bucket returned ret=" << op_ret << dendl;
     if (op_ret == -ENOENT) {
@@ -231,7 +241,7 @@ void RGWOp_Bucket_Remove::execute(optional_yield y)
     return;
   }
 
-  op_ret = bucket->remove_bucket(s, delete_children, true, &s->info, s->yield);
+  op_ret = bucket->remove_bucket(s, delete_children, s->yield);
 }
 
 class RGWOp_Set_Bucket_Quota : public RGWRESTOp {
index f085afb2beeda8e2884a7173d74ac12f75c33494..1de9756fc0a1504e94ae921c31fc705f038e9916 100644 (file)
@@ -404,8 +404,6 @@ RadosBucket::~RadosBucket() {}
 
 int RadosBucket::remove_bucket(const DoutPrefixProvider* dpp,
                               bool delete_children,
-                              bool forward_to_master,
-                              req_info* req_info,
                               optional_yield y)
 {
   int ret;
@@ -488,19 +486,6 @@ int RadosBucket::remove_bucket(const DoutPrefixProvider* dpp,
     ldpp_dout(dpp, -1) << "ERROR: unable to remove user bucket information" << dendl;
   }
 
-  if (forward_to_master) {
-    bufferlist in_data;
-    ret = store->forward_request_to_master(dpp, owner, &ot.read_version, in_data, nullptr, *req_info, y);
-    if (ret < 0) {
-      if (ret == -ENOENT) {
-       /* adjust error, we want to return with NoSuchBucket and not
-        * NoSuchKey */
-       ret = -ERR_NO_SUCH_BUCKET;
-      }
-      return ret;
-    }
-  }
-
   return ret;
 }
 
@@ -631,7 +616,7 @@ int RadosBucket::remove_bucket_bypass_gc(int concurrent_max, bool
   // this function can only be run if caller wanted children to be
   // deleted, so we can ignore the check for children as any that
   // remain are detritus from a prior bug
-  ret = remove_bucket(dpp, true, false, nullptr, y);
+  ret = remove_bucket(dpp, true, y);
   if (ret < 0) {
     ldpp_dout(dpp, -1) << "ERROR: could not remove bucket " << this << dendl;
     return ret;
index e86a0870782a2736f9029264709cfde157f40ff1..ebf6531f1471a8343cac493728cf54eb8c91b759 100644 (file)
@@ -537,7 +537,7 @@ class RadosBucket : public StoreBucket {
     virtual ~RadosBucket();
     virtual std::unique_ptr<Object> get_object(const rgw_obj_key& k) override;
     virtual int list(const DoutPrefixProvider* dpp, ListParams&, int, ListResults&, optional_yield y) override;
-    virtual int remove_bucket(const DoutPrefixProvider* dpp, bool delete_children, bool forward_to_master, req_info* req_info, optional_yield y) override;
+    virtual int remove_bucket(const DoutPrefixProvider* dpp, bool delete_children, optional_yield y) override;
     virtual int remove_bucket_bypass_gc(int concurrent_max, bool
                                        keep_index_consistent,
                                        optional_yield y, const
index 469fe6fe68fd26301001c30311b47c82b305339a..f81254bcfb0edde9a8b3c71ba38aeb4452325544 100644 (file)
@@ -1791,7 +1791,7 @@ int RGWUser::execute_remove(const DoutPrefixProvider *dpp, RGWUserAdminOpState&
         return ret;
       }
 
-      ret = bucket->remove_bucket(dpp, true, false, nullptr, y);
+      ret = bucket->remove_bucket(dpp, true, y);
       if (ret < 0) {
         set_err_msg(err_msg, "unable to delete user data");
         return ret;
index 3241645721354ed81eebcf276256927650984640..a830ff726af8d8896b90236d513c1ad3855e6532 100644 (file)
@@ -3594,7 +3594,7 @@ void RGWDeleteBucket::execute(optional_yield y)
       // do nothing; it will already have been logged
   }
 
-  op_ret = s->bucket->remove_bucket(this, false, false, nullptr, y);
+  op_ret = s->bucket->remove_bucket(this, false, y);
   if (op_ret < 0 && op_ret == -ECANCELED) {
       // lost a race, either with mdlog sync or another delete bucket operation.
       // in either case, we've already called ctl.bucket->unlink_bucket()
@@ -7351,7 +7351,7 @@ bool RGWBulkDelete::Deleter::delete_single(const acct_path_t& path, optional_yie
         goto delop_fail;
       }
     }
-    ret = bucket->remove_bucket(dpp, false, false, nullptr, s->yield);
+    ret = bucket->remove_bucket(dpp, false, s->yield);
     if (ret < 0) {
       goto delop_fail;
     }
index e7a3dfe0aa52e979e8f963c0859bbaee9fd8d210..73122e06b4b7a12ba273ea4c2a22b092fb7e3f4a 100644 (file)
@@ -660,7 +660,7 @@ class Bucket {
     /** Set the cached attributes on this bucket */
     virtual int set_attrs(Attrs a) = 0;
     /** Remove this bucket from the backing store */
-    virtual int remove_bucket(const DoutPrefixProvider* dpp, bool delete_children, bool forward_to_master, req_info* req_info, optional_yield y) = 0;
+    virtual int remove_bucket(const DoutPrefixProvider* dpp, bool delete_children, optional_yield y) = 0;
     /** Remove this bucket, bypassing garbage collection.  May be removed */
     virtual int remove_bucket_bypass_gc(int concurrent_max, bool
                                        keep_index_consistent,
index 36d76cc12e15eb87af356f76dda1b97a0fca6a4b..97da47eb6d384c2bc7b807a359aa9d04ade8cd6c 100644 (file)
@@ -236,7 +236,7 @@ namespace rgw::sal {
     return 0;
   }
 
-  int DBBucket::remove_bucket(const DoutPrefixProvider *dpp, bool delete_children, bool forward_to_master, req_info* req_info, optional_yield y)
+  int DBBucket::remove_bucket(const DoutPrefixProvider *dpp, bool delete_children, optional_yield y)
   {
     int ret;
 
index 0c75f4b98cbb3eb04f630d27ea10c113e1fcdc06..68fe4c443199e967ff86d9f3cda2255b9065eba8 100644 (file)
@@ -171,7 +171,7 @@ protected:
 
       virtual std::unique_ptr<Object> get_object(const rgw_obj_key& k) override;
       virtual int list(const DoutPrefixProvider *dpp, ListParams&, int, ListResults&, optional_yield y) override;
-      virtual int remove_bucket(const DoutPrefixProvider *dpp, bool delete_children, bool forward_to_master, req_info* req_info, optional_yield y) override;
+      virtual int remove_bucket(const DoutPrefixProvider *dpp, bool delete_children, optional_yield y) override;
       virtual int remove_bucket_bypass_gc(int concurrent_max, bool
                                        keep_index_consistent,
                                        optional_yield y, const
index dbf688a22ab0b29df8c67da7a45e46ad64f28c8f..fb9e7aa1a286d4559d36ea3589ebe574d437a6a4 100644 (file)
@@ -649,11 +649,9 @@ int FilterBucket::list(const DoutPrefixProvider* dpp, ListParams& params, int ma
 
 int FilterBucket::remove_bucket(const DoutPrefixProvider* dpp,
                                bool delete_children,
-                               bool forward_to_master,
-                               req_info* req_info,
                                optional_yield y)
 {
-  return next->remove_bucket(dpp, delete_children, forward_to_master, req_info, y);
+  return next->remove_bucket(dpp, delete_children, y);
 }
 
 int FilterBucket::remove_bucket_bypass_gc(int concurrent_max,
index dcc03df95194eaa9a12f7343cdf4973de8fbf44e..81452f22cd7de5c86510152014bbb3fe5c16a1aa 100644 (file)
@@ -413,7 +413,6 @@ public:
   virtual Attrs& get_attrs(void) override { return next->get_attrs(); }
   virtual int set_attrs(Attrs a) override { return next->set_attrs(a); }
   virtual int remove_bucket(const DoutPrefixProvider* dpp, bool delete_children,
-                           bool forward_to_master, req_info* req_info,
                            optional_yield y) override;
   virtual int remove_bucket_bypass_gc(int concurrent_max, bool
                                      keep_index_consistent,