diff options
author | Sergei Golubchik <serg@mariadb.org> | 2017-05-12 14:27:49 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2017-05-15 22:23:10 +0200 |
commit | f9264280d68dcbca2f9312c7d8620b2bcc9d0694 (patch) | |
tree | 4d68b8c47e162b862db88793d312bb93beab8e8b /sql/lock.cc | |
parent | 52aa200919b1fd9357c05bcdfc66a42e51f242b3 (diff) | |
download | mariadb-git-f9264280d68dcbca2f9312c7d8620b2bcc9d0694.tar.gz |
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.
Diffstat (limited to 'sql/lock.cc')
-rw-r--r-- | sql/lock.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/lock.cc b/sql/lock.cc index 614341fcc43..29afcc8f578 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -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; } |