This commit only affects locking behavior and doesn't have other changes.
https://github.com/bitcoin/bitcoin/pull/17261/commits/fadc08ad944cad42e805228cdd58e0332f4d7184
---
Depends on D7837
Partial backport of Core [[https://github.com/bitcoin/bitcoin/pull/17261 | PR17261]]