]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
erasure-code/jerasure: Fix thread safety in plugin init 67498/head
authorJamie Pryde <jamiepry@uk.ibm.com>
Tue, 24 Feb 2026 22:19:59 +0000 (22:19 +0000)
committerJamie Pryde <jamiepry@uk.ibm.com>
Tue, 24 Feb 2026 22:19:59 +0000 (22:19 +0000)
commit8b47e8e8360aff613982aa74597b452e7465cb50
tree37e7832b2f31a004f9d9d01af51c2834c4b80746
parentbaa5139e15e986e0d0adbc330995abc88f8abd29
erasure-code/jerasure: Fix thread safety in plugin init

The Jerasure function cauchy_good_general_coding_matrix()
has a race condition where it uses a global variable cbest_init without
proper synchronization. When multiple threads initialize PGs simultaneously,
they can race on this initialization, causing one thread to read from
cbest_all before it's fully initialized, resulting in a segmentation fault.

This commit adds a static mutex to serialize the prepare() calls during init
for all Jerasure techniques.

Fixes: https://tracker.ceph.com/issues/73246
Signed-off-by: Jamie Pryde <jamiepry@uk.ibm.com>
src/erasure-code/jerasure/ErasureCodeJerasure.cc
src/erasure-code/jerasure/ErasureCodeJerasure.h