Potential fix for Bug#25645:
Potential fix for Bug#25645:

"Move innobase_release_stat_resources(trx) outside the 'if' in
ha_innobase::external_lock(). That would add more safety that whatever
MySQL does at a query end, there would be no risk of a hang on the btr
search latch."

Also call innobase_release_temporary_latches() in the beginning of
ha_innobase::close().

Approved by:	Heikki


flynn1973/mariadb-aix,natsys/mariadb_10.2,natsys/mariadb_10.2,ollie314/server,flynn1973/mariadb-aix,natsys/mariadb_10.2,flynn1973/mariadb-aix,flynn1973/mariadb-aix,flynn1973/mariadb-aix,flynn1973/mariadb-aix,flynn1973/mariadb-aix,davidl-zend/zenddbi,flynn1973/mariadb-aix,davidl-zend/zenddbi,natsys/mariadb_10.2,davidl-zend/zenddbi,ollie314/server,ollie314/server,ollie314/server,davidl-zend/zenddbi,natsys/mariadb_10.2,davidl-zend/zenddbi,ollie314/server,ollie314/server,davidl-zend/zenddbi,flynn1973/mariadb-aix,slanterns/server,natsys/mariadb_10.2,ollie314/server,davidl-zend/zenddbi,natsys/mariadb_10.2,davidl-zend/zenddbi,flynn1973/mariadb-aix,natsys/mariadb_10.2,davidl-zend/zenddbi,natsys/mariadb_10.2,davidl-zend/zenddbi,davidl-zend/zenddbi,flynn1973/mariadb-aix,ollie314/server,natsys/mariadb_10.2,natsys/mariadb_10.2,ollie314/server,ollie314/server,ollie314/server