From 17105a0ad9e0678897a5c63cf581bde8daca049d Mon Sep 17 00:00:00 2001 From: marko <> Date: Mon, 29 Jun 2009 08:24:27 +0000 Subject: [PATCH] branches/zip: buf_page_get_gen(): Fix a race condition when reading buf_fix_count. This could explain Issue #156. Tested by Michael. --- ChangeLog | 7 +++++++ buf/buf0buf.c | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/ChangeLog b/ChangeLog index 90bb25210f2..a1ab798bec7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-06-29 The InnoDB Team + + * buf/buf0buf.c: + Fix a race condition when reading buf_fix_count. + Currently, it is not being protected by the buffer pool mutex, + but by the block mutex. + 2009-06-29 The InnoDB Team * handler/handler0alter.cc: diff --git a/buf/buf0buf.c b/buf/buf0buf.c index 24b3c933e8c..e973002ed5c 100644 --- a/buf/buf0buf.c +++ b/buf/buf0buf.c @@ -2085,12 +2085,15 @@ loop2: case BUF_BLOCK_ZIP_PAGE: case BUF_BLOCK_ZIP_DIRTY: bpage = &block->page; + /* Protect bpage->buf_fix_count. */ + mutex_enter(&buf_pool_zip_mutex); if (bpage->buf_fix_count || buf_page_get_io_fix(bpage) != BUF_IO_NONE) { /* This condition often occurs when the buffer is not buffer-fixed, but I/O-fixed by buf_page_init_for_read(). */ + mutex_exit(&buf_pool_zip_mutex); wait_until_unfixed: /* The block is buffer-fixed or I/O-fixed. Try again later. */ @@ -2102,6 +2105,7 @@ wait_until_unfixed: /* Allocate an uncompressed page. */ buf_pool_mutex_exit(); + mutex_exit(&buf_pool_zip_mutex); block = buf_LRU_get_free_block(0); ut_a(block);