]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: fix get_xattrs handling for RGW delete
authorKautilya Tripathi <kautilya.tripathi@ibm.com>
Mon, 16 Feb 2026 05:00:10 +0000 (10:30 +0530)
committerKautilya Tripathi <kautilya.tripathi@ibm.com>
Mon, 6 Apr 2026 04:55:23 +0000 (10:25 +0530)
Fix corrupted xattr values returned by get_xattrs by moving each value
independently and tracking total_len correctly.

Signed-off-by: Kautilya Tripathi <kautilya.tripathi@ibm.com>
src/crimson/osd/pg_backend.cc

index fe7b9fdc2d1c3219c4fc49bab2fedb4762fc4a8b..f3c9c1cc9f36b6341a7c45385cea3105690382fa 100644 (file)
@@ -1198,16 +1198,16 @@ PGBackend::get_attr_ierrorator::future<> PGBackend::get_xattrs(
   return get_attrs_maybe_from_cache().safe_then(
     [&delta_stats, &osd_op](auto&& attrs) {
     std::vector<std::pair<std::string, bufferlist>> user_xattrs;
-    ceph::bufferlist bl;
+    uint64_t total_len = 0;
     for (auto& [key, val] : attrs) {
       if (key.size() > 1 && key[0] == '_') {
-       bl.append(std::move(val));
-       user_xattrs.emplace_back(key.substr(1), std::move(bl));
+       total_len += val.length();
+       user_xattrs.emplace_back(key.substr(1), std::move(val));
       }
     }
     ceph::encode(user_xattrs, osd_op.outdata);
     delta_stats.num_rd++;
-    delta_stats.num_rd_kb += shift_round_up(bl.length(), 10);
+    delta_stats.num_rd_kb += shift_round_up(total_len, 10);
     return get_attr_errorator::now();
   });
 }