]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fetch_remote_obj() uses uncompressed size for encrypted objects 54371/head
authorCasey Bodley <cbodley@redhat.com>
Tue, 24 Oct 2023 20:48:06 +0000 (16:48 -0400)
committerCasey Bodley <cbodley@redhat.com>
Mon, 6 Nov 2023 19:47:11 +0000 (14:47 -0500)
use the original size from RGW_ATTR_COMPRESSION as the accounted size in
the bucket index for objects that were transferred in their
encrypted/compressed form

Fixes: https://tracker.ceph.com/issues/63306
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 526643826246fa8dbe35ea2f65bf9ad0ef9566ff)

Conflicts:
        src/rgw/driver/rados/rgw_rados.cc no req_context

src/rgw/driver/rados/rgw_rados.cc

index f6c834c69e2c1a3a0a2f3464fc3519df6b51d635..10018d4a68a0c30acab2c7dab624d49742897c17 100644 (file)
@@ -4053,6 +4053,20 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
     cs_info.blocks = move(compressor->get_compression_blocks());
     encode(cs_info, tmp);
     cb.get_attrs()[RGW_ATTR_COMPRESSION] = tmp;
+  } else if (auto c = cb.get_attrs().find(RGW_ATTR_COMPRESSION);
+             c != cb.get_attrs().end()) {
+    // if the object was transferred in its compressed+encrypted form, use its
+    // original uncompressed size
+    try {
+      RGWCompressionInfo info;
+      auto p = c->second.cbegin();
+      decode(info, p);
+      accounted_size = info.orig_size;
+    } catch (const buffer::error&) {
+      ldpp_dout(dpp, 0) << "ERROR: could not decode compression attr for "
+          "replicated object " << dest_obj << dendl;
+      // decode error isn't fatal, but we might put the wrong size in the index
+    }
   }
 
   if (override_owner) {