mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 20:12:31 +01:00
Bug#51591 deadlock in the plugins+status+variables
Potential deadlock situation involving LOCK_plugin, LOCK_global_system_variables and LOCK_status. This patch backports the fix from next-mr, unlocking LOCK_plugin before calling plugin->init() and add_status_vars().
This commit is contained in:
parent
649deaa8a1
commit
9743819d36
1 changed files with 13 additions and 5 deletions
|
@ -1006,9 +1006,14 @@ void plugin_unlock_list(THD *thd, plugin_ref *list, uint count)
|
|||
|
||||
static int plugin_initialize(struct st_plugin_int *plugin)
|
||||
{
|
||||
int ret= 1;
|
||||
DBUG_ENTER("plugin_initialize");
|
||||
|
||||
safe_mutex_assert_owner(&LOCK_plugin);
|
||||
uint state= plugin->state;
|
||||
DBUG_ASSERT(state == PLUGIN_IS_UNINITIALIZED);
|
||||
|
||||
pthread_mutex_unlock(&LOCK_plugin);
|
||||
if (plugin_type_initialize[plugin->plugin->type])
|
||||
{
|
||||
if ((*plugin_type_initialize[plugin->plugin->type])(plugin))
|
||||
|
@ -1027,8 +1032,7 @@ static int plugin_initialize(struct st_plugin_int *plugin)
|
|||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
plugin->state= PLUGIN_IS_READY;
|
||||
state= PLUGIN_IS_READY; // plugin->init() succeeded
|
||||
|
||||
if (plugin->plugin->status_vars)
|
||||
{
|
||||
|
@ -1047,7 +1051,8 @@ static int plugin_initialize(struct st_plugin_int *plugin)
|
|||
if (add_status_vars(array)) // add_status_vars makes a copy
|
||||
goto err;
|
||||
#else
|
||||
add_status_vars(plugin->plugin->status_vars); // add_status_vars makes a copy
|
||||
if (add_status_vars(plugin->plugin->status_vars))
|
||||
goto err;
|
||||
#endif /* FIX_LATER */
|
||||
}
|
||||
|
||||
|
@ -1067,9 +1072,12 @@ static int plugin_initialize(struct st_plugin_int *plugin)
|
|||
}
|
||||
}
|
||||
|
||||
DBUG_RETURN(0);
|
||||
ret= 0;
|
||||
|
||||
err:
|
||||
DBUG_RETURN(1);
|
||||
pthread_mutex_lock(&LOCK_plugin);
|
||||
plugin->state= state;
|
||||
DBUG_RETURN(ret);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue