summaryrefslogtreecommitdiff
path: root/sql/sql_acl.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r--sql/sql_acl.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 641423605aa..b01e7b1049d 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -676,12 +676,7 @@ my_bool acl_reload(THD *thd)
my_bool return_val= 1;
DBUG_ENTER("acl_reload");
- if (thd->locked_tables)
- { // Can't have locked tables here
- thd->lock=thd->locked_tables;
- thd->locked_tables=0;
- close_thread_tables(thd);
- }
+ unlock_locked_tables(thd); // Can't have locked tables here
/*
To avoid deadlocks we should obtain table locks before
@@ -697,6 +692,7 @@ my_bool acl_reload(THD *thd)
tables[0].lock_type=tables[1].lock_type=tables[2].lock_type=TL_READ;
tables[0].skip_temporary= tables[1].skip_temporary=
tables[2].skip_temporary= TRUE;
+ alloc_mdl_locks(tables, thd->mem_root);
if (simple_open_n_lock_tables(thd, tables))
{
@@ -1601,6 +1597,7 @@ bool change_password(THD *thd, const char *host, const char *user,
bzero((char*) &tables, sizeof(tables));
tables.alias= tables.table_name= (char*) "user";
tables.db= (char*) "mysql";
+ alloc_mdl_locks(&tables, thd->mem_root);
#ifdef HAVE_REPLICATION
/*
@@ -3053,6 +3050,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
? tables+2 : 0);
tables[0].lock_type=tables[1].lock_type=tables[2].lock_type=TL_WRITE;
tables[0].db=tables[1].db=tables[2].db=(char*) "mysql";
+ alloc_mdl_locks(tables, thd->mem_root);
/*
This statement will be replicated as a statement, even when using
@@ -3270,6 +3268,7 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc,
tables[0].next_local= tables[0].next_global= tables+1;
tables[0].lock_type=tables[1].lock_type=TL_WRITE;
tables[0].db=tables[1].db=(char*) "mysql";
+ alloc_mdl_locks(tables, thd->mem_root);
/*
This statement will be replicated as a statement, even when using
@@ -3408,6 +3407,7 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
tables[0].next_local= tables[0].next_global= tables+1;
tables[0].lock_type=tables[1].lock_type=TL_WRITE;
tables[0].db=tables[1].db=(char*) "mysql";
+ alloc_mdl_locks(tables, thd->mem_root);
/*
This statement will be replicated as a statement, even when using
@@ -3741,6 +3741,7 @@ static my_bool grant_reload_procs_priv(THD *thd)
table.db= (char *) "mysql";
table.lock_type= TL_READ;
table.skip_temporary= 1;
+ alloc_mdl_locks(&table, thd->mem_root);
if (simple_open_n_lock_tables(thd, &table))
{
@@ -3807,6 +3808,8 @@ my_bool grant_reload(THD *thd)
tables[0].next_local= tables[0].next_global= tables+1;
tables[0].lock_type= tables[1].lock_type= TL_READ;
tables[0].skip_temporary= tables[1].skip_temporary= TRUE;
+ alloc_mdl_locks(tables, thd->mem_root);
+
/*
To avoid deadlocks we should obtain table locks before
obtaining LOCK_grant rwlock.
@@ -5152,6 +5155,7 @@ int open_grant_tables(THD *thd, TABLE_LIST *tables)
(tables+4)->lock_type= TL_WRITE;
tables->db= (tables+1)->db= (tables+2)->db=
(tables+3)->db= (tables+4)->db= (char*) "mysql";
+ alloc_mdl_locks(tables, thd->mem_root);
#ifdef HAVE_REPLICATION
/*