From ab92d8d2516033f99632e15c66af85af39db8539 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Thu, 2 Sep 2021 13:30:45 -0700 Subject: [PATCH] Add quick test for racing creates Add a quick test to make sure that create is validating stale dentries before deciding if it should create or return -eexist. Signed-off-by: Zach Brown --- tests/golden/basic-posix-consistency | 2 ++ tests/tests/basic-posix-consistency.sh | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/tests/golden/basic-posix-consistency b/tests/golden/basic-posix-consistency index 21af43aa..87951532 100644 --- a/tests/golden/basic-posix-consistency +++ b/tests/golden/basic-posix-consistency @@ -53,3 +53,5 @@ mv: cannot move ‘/mnt/test/test/basic-posix-consistency/dir/c/clobber’ to == inode indexes match after syncing existing == inode indexes match after copying and syncing == inode indexes match after removing and syncing +== concurrent creates make one file +one-file diff --git a/tests/tests/basic-posix-consistency.sh b/tests/tests/basic-posix-consistency.sh index 94c5bd0d..5571405a 100644 --- a/tests/tests/basic-posix-consistency.sh +++ b/tests/tests/basic-posix-consistency.sh @@ -197,4 +197,13 @@ scoutfs walk-inodes -p "$T_M0" -- data_seq 0 -1 > "$T_TMP.0" scoutfs walk-inodes -p "$T_M1" -- data_seq 0 -1 > "$T_TMP.1" diff -u "$T_TMP.0" "$T_TMP.1" +echo "== concurrent creates make one file" +mkdir "$T_D0/concurrent" +for i in $(t_fs_nrs); do + eval p="\$T_D${i}/concurrent/one-file" + touch "$p" 2>&1 > "$T_TMP.multi-create.$i" & +done +wait +ls "$T_D0/concurrent" + t_pass