From: Matthew N. Heler Date: Wed, 8 Apr 2026 23:16:18 +0000 (-0500) Subject: rgw: fix cloud tier multipart resume starting at part number 0 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=04741d381b6c47ac2e06e644c33b1aa58e4a12ac;p=ceph.git rgw: fix cloud tier multipart resume starting at part number 0 When resuming a cloud tier multipart upload, the part-size calculation was inside the fresh-init block and never executed. cur_part, num_parts, and part_size stayed at 0, causing the remote endpoint to reject part number 0 as invalid. Move the part-size calculation out of the init block so it runs for both fresh and resumed uploads. Signed-off-by: Matthew N. Heler --- diff --git a/src/rgw/driver/rados/rgw_lc_tier.cc b/src/rgw/driver/rados/rgw_lc_tier.cc index 15aa5653652e..d924c23d38a7 100644 --- a/src/rgw/driver/rados/rgw_lc_tier.cc +++ b/src/rgw/driver/rados/rgw_lc_tier.cc @@ -1339,7 +1339,7 @@ static int cloud_tier_multipart_transfer(RGWLCCloudTierCtx& tier_ctx) { } if (ret >= 0) { - // check here that mtime and size did not change + // check here that mtime and size did not change if (status.mtime != obj_properties.mtime || status.obj_size != obj_size || status.etag != obj_properties.etag) { cloud_tier_abort_multipart_upload(tier_ctx, dest_obj, status_obj, status.upload_id); @@ -1347,7 +1347,7 @@ static int cloud_tier_multipart_transfer(RGWLCCloudTierCtx& tier_ctx) { } } - if (ret == -ENOENT) { + if (ret == -ENOENT) { RGWLCStreamRead readf(tier_ctx.cct, tier_ctx.dpp, tier_ctx.obj, tier_ctx.o.meta.mtime); readf.init(); @@ -1369,11 +1369,12 @@ static int cloud_tier_multipart_transfer(RGWLCCloudTierCtx& tier_ctx) { if (ret < 0) { ldpp_dout(tier_ctx.dpp, 0) << "ERROR: failed to driver multipart upload state, ret=" << ret << dendl; - // continue with upload anyway + // continue with upload anyway } + } #define MULTIPART_MAX_PARTS 10000 -#define MULTIPART_MAX_PARTS 10000 + { uint64_t min_part_size = obj_size / MULTIPART_MAX_PARTS; uint64_t min_conf_size = tier_ctx.multipart_min_part_size; @@ -1383,9 +1384,9 @@ static int cloud_tier_multipart_transfer(RGWLCCloudTierCtx& tier_ctx) { part_size = std::max(min_conf_size, min_part_size); num_parts = (obj_size + part_size - 1) / part_size; - cur_part = 1; - cur_ofs = 0; } + cur_part = 1; + cur_ofs = 0; for (; (uint32_t)cur_part <= num_parts; ++cur_part) { ldpp_dout(tier_ctx.dpp, 20) << "cur_part = "<< cur_part << ", info.ofs = " << cur_ofs << ", info.size = " << part_size << ", obj size = " << obj_size<< ", num_parts:" << num_parts << dendl;