spa_config_tryenter incorrectly handles the multiple-lock case
Review Request #264 - Created Oct. 20, 2015 and submitted
If spa_config_tryenter fails to acquire a particular lock, all locks that have been acquired in the mean time should be released. Unfortunately, the existing arithmetic in that case doesn't do that, so some locks can be left acquired.
Fix from Nexenta, originally reviewed internally by Alek Pinchuk and Josef 'Jeff' Sipek.
This is required for ZFS TRIM/UNMAP support, otherwise the code panicks when a "zpool trim <poolname>" command is issued before the last on-demand TRIM has finished.