fn lock_directory(sess: &Session, session_dir: &Path) -> (Lock, PathBuf)
Allocate the lock-file and lock it.