Closes strongswan/strongswan#343.
The write_lock call fails with EDEADLK and unlocks in the next recursion level.