Extract the lock-setting functions into their own, as we cannot assume that it's ok for us to set this unconditionally.