mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
MDEV-11630 Call mutex_free() before freeing the mutex list
Make some global fil_crypt_ variables static. fil_close(): Call mutex_free(&fil_system->mutex) also in InnoDB, not only in XtraDB. In InnoDB, sync_close() was called before fil_close(). innobase_shutdown_for_mysql(): Call fil_close() before sync_close(), similar to XtraDB shutdown. fil_space_crypt_cleanup(): Call mutex_free() to pair with fil_space_crypt_init(). fil_crypt_threads_cleanup(): Call mutex_free() to pair with fil_crypt_threads_init().
This commit is contained in:
@@ -41,12 +41,12 @@ Modified Jan Lindström jan.lindstrom@mariadb.com
|
||||
#include <my_crypt.h>
|
||||
|
||||
/** Mutex for keys */
|
||||
UNIV_INTERN ib_mutex_t fil_crypt_key_mutex;
|
||||
static ib_mutex_t fil_crypt_key_mutex;
|
||||
|
||||
static bool fil_crypt_threads_inited = false;
|
||||
|
||||
#ifdef UNIV_PFS_MUTEX
|
||||
UNIV_INTERN mysql_pfs_key_t fil_crypt_key_mutex_key;
|
||||
static mysql_pfs_key_t fil_crypt_key_mutex_key;
|
||||
#endif
|
||||
|
||||
/** Is encryption enabled/disabled */
|
||||
@@ -62,19 +62,19 @@ static uint srv_n_fil_crypt_threads_started = 0;
|
||||
UNIV_INTERN uint srv_fil_crypt_rotate_key_age = 1;
|
||||
|
||||
/** Event to signal FROM the key rotation threads. */
|
||||
UNIV_INTERN os_event_t fil_crypt_event;
|
||||
static os_event_t fil_crypt_event;
|
||||
|
||||
/** Event to signal TO the key rotation threads. */
|
||||
UNIV_INTERN os_event_t fil_crypt_threads_event;
|
||||
static os_event_t fil_crypt_threads_event;
|
||||
|
||||
/** Event for waking up threads throttle */
|
||||
UNIV_INTERN os_event_t fil_crypt_throttle_sleep_event;
|
||||
static os_event_t fil_crypt_throttle_sleep_event;
|
||||
|
||||
/** Mutex for key rotation threads */
|
||||
UNIV_INTERN ib_mutex_t fil_crypt_threads_mutex;
|
||||
static ib_mutex_t fil_crypt_threads_mutex;
|
||||
|
||||
#ifdef UNIV_PFS_MUTEX
|
||||
UNIV_INTERN mysql_pfs_key_t fil_crypt_threads_mutex_key;
|
||||
static mysql_pfs_key_t fil_crypt_threads_mutex_key;
|
||||
#endif
|
||||
|
||||
/** Variable ensuring only 1 thread at time does initial conversion */
|
||||
@@ -96,13 +96,11 @@ static fil_crypt_stat_t crypt_stat;
|
||||
static ib_mutex_t crypt_stat_mutex;
|
||||
|
||||
#ifdef UNIV_PFS_MUTEX
|
||||
UNIV_INTERN mysql_pfs_key_t fil_crypt_stat_mutex_key;
|
||||
#endif
|
||||
static mysql_pfs_key_t fil_crypt_stat_mutex_key;
|
||||
|
||||
/**
|
||||
* key for crypt data mutex
|
||||
*/
|
||||
#ifdef UNIV_PFS_MUTEX
|
||||
UNIV_INTERN mysql_pfs_key_t fil_crypt_data_mutex_key;
|
||||
#endif
|
||||
|
||||
@@ -140,6 +138,8 @@ fil_space_crypt_cleanup()
|
||||
/*=====================*/
|
||||
{
|
||||
os_event_free(fil_crypt_throttle_sleep_event);
|
||||
mutex_free(&fil_crypt_key_mutex);
|
||||
mutex_free(&crypt_stat_mutex);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -362,7 +362,7 @@ fil_space_destroy_crypt_data(
|
||||
fil_space_crypt_t* c = *crypt_data;
|
||||
c->~fil_space_crypt_struct();
|
||||
mem_free(c);
|
||||
(*crypt_data) = NULL;
|
||||
*crypt_data = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2483,6 +2483,7 @@ fil_crypt_threads_cleanup()
|
||||
{
|
||||
os_event_free(fil_crypt_event);
|
||||
os_event_free(fil_crypt_threads_event);
|
||||
mutex_free(&fil_crypt_threads_mutex);
|
||||
fil_crypt_threads_inited = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -6449,10 +6449,7 @@ fil_close(void)
|
||||
{
|
||||
fil_space_crypt_cleanup();
|
||||
|
||||
#ifndef UNIV_HOTBACKUP
|
||||
/* The mutex should already have been freed. */
|
||||
ut_ad(fil_system->mutex.magic_n == 0);
|
||||
#endif /* !UNIV_HOTBACKUP */
|
||||
mutex_free(&fil_system->mutex);
|
||||
|
||||
hash_table_free(fil_system->spaces);
|
||||
|
||||
|
||||
@@ -3244,9 +3244,9 @@ innobase_shutdown_for_mysql(void)
|
||||
que_close();
|
||||
row_mysql_close();
|
||||
srv_mon_free();
|
||||
fil_close();
|
||||
sync_close();
|
||||
srv_free();
|
||||
fil_close();
|
||||
|
||||
/* 4. Free the os_conc_mutex and all os_events and os_mutexes */
|
||||
|
||||
|
||||
@@ -41,12 +41,12 @@ Modified Jan Lindström jan.lindstrom@mariadb.com
|
||||
#include <my_crypt.h>
|
||||
|
||||
/** Mutex for keys */
|
||||
UNIV_INTERN ib_mutex_t fil_crypt_key_mutex;
|
||||
static ib_mutex_t fil_crypt_key_mutex;
|
||||
|
||||
static bool fil_crypt_threads_inited = false;
|
||||
|
||||
#ifdef UNIV_PFS_MUTEX
|
||||
UNIV_INTERN mysql_pfs_key_t fil_crypt_key_mutex_key;
|
||||
static mysql_pfs_key_t fil_crypt_key_mutex_key;
|
||||
#endif
|
||||
|
||||
/** Is encryption enabled/disabled */
|
||||
@@ -62,19 +62,19 @@ static uint srv_n_fil_crypt_threads_started = 0;
|
||||
UNIV_INTERN uint srv_fil_crypt_rotate_key_age = 1;
|
||||
|
||||
/** Event to signal FROM the key rotation threads. */
|
||||
UNIV_INTERN os_event_t fil_crypt_event;
|
||||
static os_event_t fil_crypt_event;
|
||||
|
||||
/** Event to signal TO the key rotation threads. */
|
||||
UNIV_INTERN os_event_t fil_crypt_threads_event;
|
||||
static os_event_t fil_crypt_threads_event;
|
||||
|
||||
/** Event for waking up threads throttle */
|
||||
UNIV_INTERN os_event_t fil_crypt_throttle_sleep_event;
|
||||
static os_event_t fil_crypt_throttle_sleep_event;
|
||||
|
||||
/** Mutex for key rotation threads */
|
||||
UNIV_INTERN ib_mutex_t fil_crypt_threads_mutex;
|
||||
static ib_mutex_t fil_crypt_threads_mutex;
|
||||
|
||||
#ifdef UNIV_PFS_MUTEX
|
||||
UNIV_INTERN mysql_pfs_key_t fil_crypt_threads_mutex_key;
|
||||
static mysql_pfs_key_t fil_crypt_threads_mutex_key;
|
||||
#endif
|
||||
|
||||
/** Variable ensuring only 1 thread at time does initial conversion */
|
||||
@@ -96,13 +96,11 @@ static fil_crypt_stat_t crypt_stat;
|
||||
static ib_mutex_t crypt_stat_mutex;
|
||||
|
||||
#ifdef UNIV_PFS_MUTEX
|
||||
UNIV_INTERN mysql_pfs_key_t fil_crypt_stat_mutex_key;
|
||||
#endif
|
||||
static mysql_pfs_key_t fil_crypt_stat_mutex_key;
|
||||
|
||||
/**
|
||||
* key for crypt data mutex
|
||||
*/
|
||||
#ifdef UNIV_PFS_MUTEX
|
||||
UNIV_INTERN mysql_pfs_key_t fil_crypt_data_mutex_key;
|
||||
#endif
|
||||
|
||||
@@ -140,6 +138,8 @@ fil_space_crypt_cleanup()
|
||||
/*=====================*/
|
||||
{
|
||||
os_event_free(fil_crypt_throttle_sleep_event);
|
||||
mutex_free(&fil_crypt_key_mutex);
|
||||
mutex_free(&crypt_stat_mutex);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -362,7 +362,7 @@ fil_space_destroy_crypt_data(
|
||||
fil_space_crypt_t* c = *crypt_data;
|
||||
c->~fil_space_crypt_struct();
|
||||
mem_free(c);
|
||||
(*crypt_data) = NULL;
|
||||
*crypt_data = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2483,6 +2483,7 @@ fil_crypt_threads_cleanup()
|
||||
{
|
||||
os_event_free(fil_crypt_event);
|
||||
os_event_free(fil_crypt_threads_event);
|
||||
mutex_free(&fil_crypt_threads_mutex);
|
||||
fil_crypt_threads_inited = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2008, Google Inc.
|
||||
Copyright (c) 2009, Percona Inc.
|
||||
Copyright (c) 2013, 2015, MariaDB Corporation
|
||||
Copyright (c) 2013, 2016, MariaDB Corporation
|
||||
|
||||
Portions of this file contain modifications contributed and copyrighted by
|
||||
Google, Inc. Those modifications are gratefully acknowledged and are described
|
||||
|
||||
Reference in New Issue
Block a user