Avoid acquiring write lock just to check whether we need a write lock.