@michaelcahill, this is the code to change read/write locks to no longer track if an exclusive lock was acquired by the caller, instead track in the code if we acquired an exclusive lock and choose the correct unlock call based on that information.
I'm still planning to write some test code for this work, but wanted to push it so you can look at it (I'll also call out a few of the changes for special attention).