MDEV-27058 introduced a deadlock between trx_purge_truncate_history() and buf_pool_t::release_freed_page(). The former function is holding buf_pool.flush_list_mutex while waiting for a page X-latch:
At the same time, buf_pool_t::release_freed_page() may hold a U-latch on this page while waiting for buf_pool.flush_list_mutex.
MDEV-27058, there was no problem here, because we would first buffer-fix the block, then release buf_pool.flush_list_mutex and only then acquire the block X-latch.
To fix this, we may invoke bpage->lock.x_lock_try() instead. If it fails, we may release and reacquire buf_pool.flush_list_mutex and restart the scan.
MDEV-27058 was not part of any release yet, this regression does not affect any release.