summaryrefslogtreecommitdiff
path: root/storage/xtradb/buf/buf0lru.c
diff options
context:
space:
mode:
authorJan Lindström <jplindst@mariadb.org>2014-07-26 21:14:21 +0300
committerJan Lindström <jplindst@mariadb.org>2014-07-26 21:14:21 +0300
commit8ae267400c6a51908d964b0c99d5614fc9f7a9b3 (patch)
tree4206207978c56ba8d4d82d9f47ffaaa83adbb8f6 /storage/xtradb/buf/buf0lru.c
parentbe667b8c42f9d67f61409be594603d73f007d405 (diff)
downloadmariadb-git-8ae267400c6a51908d964b0c99d5614fc9f7a9b3.tar.gz
Fix InnoDB: Assertion failure in thread 2868898624 in file buf0lru.c line 1000
InnoDB: Failing assertion: mutex_own(&buf_pool->LRU_list_mutex) and InnoDB: Assertion failure in thread 2868898624 in file buf0lru.c line 1077 InnoDB: Failing assertion: mutex_own(&buf_pool->LRU_list_mutex) Analysis: Function buf_LRU_free_block might release LRU_list_mutex on same cases to avoid mutex order problems, we need to take it back before accessing list.
Diffstat (limited to 'storage/xtradb/buf/buf0lru.c')
-rw-r--r--storage/xtradb/buf/buf0lru.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/storage/xtradb/buf/buf0lru.c b/storage/xtradb/buf/buf0lru.c
index a58fc68b24a..7156068ccc5 100644
--- a/storage/xtradb/buf/buf0lru.c
+++ b/storage/xtradb/buf/buf0lru.c
@@ -1013,6 +1013,10 @@ restart:
*have_LRU_mutex = FALSE;
}
return(TRUE);
+ } else if (!*have_LRU_mutex) {
+ *have_LRU_mutex = TRUE;
+ mutex_enter(&buf_pool->LRU_list_mutex);
+ taken_LRU_mutex = TRUE;
}
}
@@ -1097,6 +1101,10 @@ restart:
}
return(TRUE);
+ } else if (!*have_LRU_mutex) {
+ mutex_enter(&buf_pool->LRU_list_mutex);
+ taken_LRU_mutex = TRUE;
+ *have_LRU_mutex = TRUE;
}
}
@@ -1955,9 +1963,10 @@ alloc:
mutex_exit((mutex_t*)block_mutex);
if (!*have_LRU_mutex) {
- mutex_enter(&buf_pool->LRU_list_mutex); /* optimistic */
+ mutex_enter(&buf_pool->LRU_list_mutex);
*have_LRU_mutex = TRUE;
}
+
rw_lock_x_lock(&buf_pool->page_hash_latch);
mutex_enter((mutex_t*)block_mutex);
@@ -1968,10 +1977,12 @@ not_freed:
if (b) {
buf_page_free_descriptor(b);
}
+
if (*have_LRU_mutex) {
mutex_exit(&buf_pool->LRU_list_mutex);
*have_LRU_mutex = FALSE;
}
+
rw_lock_x_unlock(&buf_pool->page_hash_latch);
return(FALSE);
} else if (zip || !bpage->zip.data) {
@@ -2106,10 +2117,12 @@ not_freed:
}
//buf_pool_mutex_exit(buf_pool);
+
if (*have_LRU_mutex) {
mutex_exit(&buf_pool->LRU_list_mutex);
*have_LRU_mutex = FALSE;
}
+
rw_lock_x_unlock(&buf_pool->page_hash_latch);
mutex_exit((mutex_t*)block_mutex);
@@ -2143,10 +2156,12 @@ not_freed:
}
//buf_pool_mutex_enter(buf_pool);
+
if (!*have_LRU_mutex) {
mutex_enter(&buf_pool->LRU_list_mutex);
*have_LRU_mutex = TRUE;
}
+
mutex_enter((mutex_t*)block_mutex);
if (b) {
@@ -2161,7 +2176,6 @@ not_freed:
mutex_exit(&buf_pool->LRU_list_mutex);
*have_LRU_mutex = FALSE;
}
-
} else {
/* The block_mutex should have been released by
buf_LRU_block_remove_hashed_page() when it returns
@@ -2173,6 +2187,7 @@ not_freed:
mutex_exit(&buf_pool->LRU_list_mutex);
*have_LRU_mutex = FALSE;
}
+
rw_lock_x_unlock(&buf_pool->page_hash_latch);
}