Simplifies the code a bit, even though locking is a bit more coarse
now. We can make it faster later if it matters, especially now that
there's a test (which reliably failed before this fix).
Fixes camlistore.org/issue/264
Change-Id: Ifac79728f6a105ba76a60997c55c5d7d818f6f71