From: Matt Benjamin Date: Tue, 14 Apr 2026 19:25:28 +0000 (-0400) Subject: rgw: return additional checksum headers too X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3a0bf9bb583e78079a49aa9e96a8eebade07fbdc;p=ceph.git rgw: return additional checksum headers too Signed-off-by: Matt Benjamin --- diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index e92459429890..3810984194c3 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -7666,6 +7666,36 @@ bool RGWCompleteMultipart::check_previously_completed(const RGWMultiCompleteUplo << "() object etag and re-calculated etag match, etag: " << oetag << dendl; etag = oetag; + + /* assign cksum and armored_cksum */ + auto iter = sattrs.find(RGW_ATTR_CKSUM); + if (iter != sattrs.end()) { + auto bliter = iter->second.cbegin(); + try { + rgw::cksum::Cksum tcksum; + tcksum.decode(bliter); + cksum = std::move(tcksum); + + /* extract a multipart etag's part-count suffix, or "" if + * (impossibly) it's not present */ + auto extract_part_count = [](std::string& etag) -> std::string { + std::string str{""}; + auto pos = etag.find("-"); + if (pos != std::string::npos) { + str = etag.substr(pos, etag.length()-pos); + } + return str; + }; + + armored_cksum = cksum->to_armor(); + if (cksum->composite()) { + *armored_cksum += extract_part_count(etag); + } + } catch (buffer::error& err) { + ldpp_dout(this, 0) << "ERROR: could not decode stored cksum, caught buffer::error" << dendl; + } + } + return true; }