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.
table corruption
Moved the testcase from the file myisam.test to the new testfile
mysiam_debug.test
mysql-test/r/myisam.result:
Removed result file for BUG#40827
mysql-test/r/myisam_debug.result:
Result file for BUG#40827
mysql-test/t/myisam.test:
Removed testcase for BUG#40827
mysql-test/t/myisam_debug.test:
TestCase for BUG#40827