From: Alex Ainscow Date: Wed, 18 Jun 2025 19:46:49 +0000 (+0100) Subject: osd: Fix decode for some extent cache reads. X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=1a91c3d5f35b22e1fbcf8509d25c96d684301a80;p=ceph-ci.git osd: Fix decode for some extent cache reads. 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 (cherry picked from commit 2ab45a22397112916bbcdb82adb85f99599e03c0) --- diff --git a/src/osd/ECUtil.cc b/src/osd/ECUtil.cc index 399d915549a..cd25c3305fe 100644 --- a/src/osd/ECUtil.cc +++ b/src/osd/ECUtil.cc @@ -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; diff --git a/src/test/osd/TestECBackend.cc b/src/test/osd/TestECBackend.cc index c7e6e585a7f..62d70b64d97 100644 --- a/src/test/osd/TestECBackend.cc +++ b/src/test/osd/TestECBackend.cc @@ -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); +}