From 902d07499df4ed68721821691e0477e673ab15a5 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Wed, 12 Jul 2023 16:13:34 -0400 Subject: [PATCH] rgw: preserve RGW_ATTR_CRYPT_PARTS of already-replicated objects Signed-off-by: Casey Bodley --- src/rgw/driver/rados/rgw_rados.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/rgw/driver/rados/rgw_rados.cc b/src/rgw/driver/rados/rgw_rados.cc index 67f23ebb5d8..b357ecbf670 100644 --- a/src/rgw/driver/rados/rgw_rados.cc +++ b/src/rgw/driver/rados/rgw_rados.cc @@ -3434,9 +3434,11 @@ public: manifest_bl = std::move(iter->second); src_attrs.erase(iter); - // if the source object was encrypted, preserve the original object's - // part lengths - if (src_attrs.count(RGW_ATTR_CRYPT_MODE)) { + // if the source object was encrypted, preserve the part lengths from + // the original object's manifest in RGW_ATTR_CRYPT_PARTS. if the object + // already replicated and has the RGW_ATTR_CRYPT_PARTS attr, preserve it + if (src_attrs.count(RGW_ATTR_CRYPT_MODE) && + !src_attrs.count(RGW_ATTR_CRYPT_PARTS)) { std::vector parts_len; int r = RGWGetObj_BlockDecrypt::read_manifest_parts(dpp, manifest_bl, parts_len); -- 2.39.5