From b0ff791618d97487fb7515d3f785b37f46eba132 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 30 Oct 2020 19:06:50 +0200 Subject: [PATCH] MDEV-24054 Assertion in_LRU_list failed in buf_flush_try_neighbors() buf_flush_try_neighbors(): Before invoking buf_page_t::ready_for_flush(), check that the freshly looked up buf_pool.page_hash entry actually is a buffer page and not a buf_pool.watch[] sentinel for purge buffering. This race condition was introduced in MDEV-15053 (commit b1ab211dee599eabd9a5b886fafa3adea29ae041). It is rather hard to hit this bug, because buf_flush_check_neighbors() already checked the condition. The problem exists if buf_pool.watch_set() was invoked for a page in the range after the check in buf_flush_check_neighbor() had been finished. --- storage/innobase/buf/buf0flu.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index cc2f4c36fa4..ac6c45deeab 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -1106,7 +1106,8 @@ static ulint buf_flush_try_neighbors(fil_space_t *space, because the flushed blocks are soon freed */ if (!lru || id == page_id || bpage->is_old()) { - if (bpage->ready_for_flush() && buf_flush_page(bpage, lru, space)) + if (!buf_pool.watch_is_sentinel(*bpage) && + bpage->ready_for_flush() && buf_flush_page(bpage, lru, space)) { ++count; continue;