]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw/reshard: refuse to reshard to new_num_shards=0
authorCasey Bodley <cbodley@redhat.com>
Wed, 1 Mar 2023 15:44:31 +0000 (10:44 -0500)
committerCasey Bodley <cbodley@redhat.com>
Fri, 3 Mar 2023 19:44:26 +0000 (14:44 -0500)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 4db197e858a4cedef4ad86af66d9b2cd2f4e4e31)

src/rgw/driver/rados/rgw_reshard.cc

index 6c262c658c9c6f2d3c54a79496afd8ef61bee6eb..01d917022d30ba0febe7bc1d1beed67848e1a0d9 100644 (file)
@@ -504,6 +504,11 @@ static int init_reshard(rgw::sal::RadosStore* store,
                         uint32_t new_num_shards,
                         const DoutPrefixProvider *dpp)
 {
+  if (new_num_shards == 0) {
+    ldpp_dout(dpp, 0) << "ERROR: " << __func__ << " got invalid new_num_shards=0" << dendl;
+    return -EINVAL;
+  }
+
   int ret = init_target_layout(store, bucket_info, bucket_attrs, fault, new_num_shards, dpp);
   if (ret < 0) {
     return ret;