diff options
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r-- | sql/sql_show.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 2811483a0b1..fbd163f4667 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -6215,14 +6215,20 @@ int fill_status(THD *thd, TABLE_LIST *tables, COND *cond) tmp1= &thd->status_var; } - mysql_mutex_lock(&LOCK_status); + /* + Avoid recursive acquisition of LOCK_status in cases when WHERE clause + represented by "cond" contains subquery on I_S.SESSION/GLOBAL_STATUS. + */ + if (thd->fill_status_recursion_level++ == 0) + mysql_mutex_lock(&LOCK_status); if (option_type == OPT_GLOBAL) calc_sum_of_all_status(&tmp); res= show_status_array(thd, wild, (SHOW_VAR *)all_status_vars.buffer, option_type, tmp1, "", tables->table, upper_case_names, cond); - mysql_mutex_unlock(&LOCK_status); + if (thd->fill_status_recursion_level-- == 1) + mysql_mutex_unlock(&LOCK_status); DBUG_RETURN(res); } |