hash: fix a multi-writer race condition