Add naive lock logic of directory.