MDEV-25113 removed the acquisition of buf_pool.flush_list_mutex from buf_page_write_complete(). But, acquiring buf_pool.mutex should not really be necessary except in eviction flushing (request.is_LRU()) or when the block->lock is not available (no uncompressed copy of a ROW_FORMAT=COMPRESSED exists in the buffer pool).
In the common case of checkpoint flushing, we can actually rely on the block->lock to protect us. The only other reason to hold buf_pool.mutex was updating the count of outstanding page writes (buf_pool.n_flush_list()). That counter is actually redundant, because we can refer to write_slots->pending_io_count().
Finally, we would remove pthread_cond_broadcast(&buf_pool.done_flush_list) from buf_page_write_complete(). Only the buf_flush_page_cleaner would call that. To wait for page writes to complete, os_aio_wait_until_no_pending_writes() may be invoked.