]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd: Fix decode for some extent cache reads.
authorAlex Ainscow <aainscow@uk.ibm.com>
Wed, 18 Jun 2025 19:46:49 +0000 (20:46 +0100)
committerAlex Ainscow <aainscow@uk.ibm.com>
Wed, 17 Sep 2025 08:43:26 +0000 (09:43 +0100)
The extent cache in EC can cause the backend to perform some surprising reads. Some
of the patterns were discovered in test that caused the decode to attempt to
decode more data than was anticipated during the read planning, leading to an
assert. This simple fix reduces the scope of the decode to the minimum.

Signed-off-by: Alex Ainscow <aainscow@uk.ibm.com>
(cherry picked from commit 2ab45a22397112916bbcdb82adb85f99599e03c0)

src/osd/ECUtil.cc
src/test/osd/TestECBackend.cc

index 399d915549a5888f69ab100705e5774c9bb3f94e..cd25c3305fe40eaa1e006d3174a6d3e0c2cff1c4 100644 (file)
@@ -674,7 +674,11 @@ int shard_extent_map_t::decode(const ErasureCodeInterfaceRef &ec_impl,
        */
       decode_set.insert(decode_for_parity_shards);
       need_set.insert(decode_for_parity_shards);
-      extent_set decode_for_parity = get_extent_superset();
+      extent_set decode_for_parity;
+
+      for (auto shard : encode_set) {
+        decode_for_parity.insert(want.at(shard));
+      }
 
       for (auto shard : decode_for_parity_shards) {
         extent_set parity_pad;
index c7e6e585a7f0d497aec3950ae28b2947d26f49b0..62d70b64d97c091e08772a7ed690458e3d9bfda4 100644 (file)
@@ -1481,3 +1481,24 @@ TEST(ECCommon, decode7) {
 
   test_decode(k, m, chunk_size, object_size, want, acting_set);
 }
+
+TEST(ECCommon, decode8) {
+  const unsigned int k = 3;
+  const unsigned int m = 2;
+  const uint64_t chunk_size = 64 * 1024;
+  const uint64_t object_size = 672 * 1024;
+
+
+  ECUtil::shard_extent_set_t want(k+m);
+  shard_id_set acting_set;
+  want[shard_id_t(0)].insert(64 * 1024, 64 * 1024);
+  want[shard_id_t(2)].insert(32 * 1024, 32 * 1024);
+  want[shard_id_t(3)].insert(32 * 1024, 64 * 1024);
+  want[shard_id_t(4)].insert(32 * 1024, 64 * 1024);
+
+
+  acting_set.insert(shard_id_t(0));
+  acting_set.insert_range(shard_id_t(2), 2);
+
+  test_decode(k, m, chunk_size, object_size, want, acting_set);
+}