Write lock around refcnt changes.