mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
MDEV-12761 Error return from external_lock make the server crash
bunch of bugs when external_lock() fails on unlock: * mi_lock_database() used mi_mark_crashed() under share->intern_lock, but mi_mark_crashed() itself locks this mutex. * handler::close() required table to be unlocked, but failed external_lock didn't count as unlock * mysql_unlock_tables() ignored all unlock errors, but they still set the error status in stmt_da.
This commit is contained in:
@@ -380,12 +380,15 @@ static int lock_external(THD *thd, TABLE **tables, uint count)
|
||||
void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock, bool free_lock)
|
||||
{
|
||||
DBUG_ENTER("mysql_unlock_tables");
|
||||
bool errors= thd->is_error();
|
||||
if (sql_lock->table_count)
|
||||
unlock_external(thd, sql_lock->table, sql_lock->table_count);
|
||||
if (sql_lock->lock_count)
|
||||
thr_multi_unlock(sql_lock->locks, sql_lock->lock_count, 0);
|
||||
if (free_lock)
|
||||
my_free(sql_lock);
|
||||
if (!errors)
|
||||
thd->clear_error();
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user