From: Alex Ainscow Date: Wed, 11 Feb 2026 18:11:12 +0000 (+0000) Subject: mon: Deny EC optimizations (fast EC) for non-4k-aligned chunk-sizes. X-Git-Tag: testing/wip-pdonnell-testing-20260219.182737-tentacle~2^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1195a583d829c6b706df111159cc5c02172a2f88;p=ceph-ci.git mon: Deny EC optimizations (fast EC) for non-4k-aligned chunk-sizes. There are some bugs in the way Fast EC handles non 4k-aligned chunk sizes. Such chunk sizes are buggy and even if they did work, the performance would not be very good. Storage efficiency is also not helped by these unusual encodings. This commit will reject any attempt to turn optimizations (fast EC) on. If the default is set to turn optimizations on, then this will be ignored if the profile is not 4k aligned. Note that to create a profile in the first place requires a --force override. Fixes: https://tracker.ceph.com/issues/74813 Signed-off-by: Alex Ainscow (cherry picked from commit 442b45295f707b8d155caf5d1d51afd4664900db) --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 451bf7aa9e0..530a3299309 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -8391,12 +8391,13 @@ int OSDMonitor::enable_pool_ec_optimizations(pg_pool_t &p, } if (enable) { ErasureCodeInterfaceRef erasure_code; - unsigned int k, m; + unsigned int k, m, chunk_size; stringstream tmp; int err = get_erasure_code(p.erasure_code_profile, &erasure_code, &tmp); if (err == 0) { k = erasure_code->get_data_chunk_count(); m = erasure_code->get_coding_chunk_count(); + chunk_size = erasure_code->get_chunk_size(p.get_stripe_width()); } else { if (ss) { *ss << "get_erasure_code failed: " << tmp.str(); @@ -8410,6 +8411,13 @@ int OSDMonitor::enable_pool_ec_optimizations(pg_pool_t &p, } return -EINVAL; } + + if ((chunk_size % 4096) != 0) { + if (ss) { + *ss << "stripe_unit must be divisible by 4096 to enable ec optimizations"; + } + return -EINVAL; + } // Restrict the set of shards that can be a primary to the 1st data // raw_shard (raw_shard 0) and the coding parity raw_shards because§ // the other shards (including local parity for LRC) may not have @@ -8915,7 +8923,7 @@ int OSDMonitor::prepare_command_pool_set(const cmdmap_t& cmdmap, return -EINVAL; } bool was_enabled = p.allows_ecoptimizations(); - int r = enable_pool_ec_optimizations(p, nullptr, enable); + int r = enable_pool_ec_optimizations(p, &ss, enable); if (r != 0) { return r; }