Make sure we don't block on write() while holding locks.