From c64855fca1504bddcb0fc7ad7316d8d6b20a9c6f Mon Sep 17 00:00:00 2001 From: Patrick Farrell Date: Wed, 1 May 2019 15:05:37 -0400 Subject: [PATCH] LU-12261 tests: Race between exec and truncate Execing '$tdir/sleep' with & doesn't guarantee the file is actually open before returning, so it is sometimes losing the race with truncate, resulting in errors like this: /usr/lib64/lustre/tests/sanity.sh: line 4172: /mnt/lustre/d43b.sanity/sleep: Text file busy Where $tdir/sleep gets ETXTBSY, instead of truncate as expected. A 1 second delay should be enough to guarantee exec wins the race vs truncate. Test-Parameters: trivial Test-Parameters: testgroup=review-ldiskfs-arm Test-Parameters: testgroup=review-ldiskfs Test-Parameters: testgroup=review-ldiskfs-arm Signed-off-by: Patrick Farrell Change-Id: Ice6f4567805e64c3be755b6c684b6a086a348dd8 Reviewed-on: https://review.whamcloud.com/34791 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: James Nunez Reviewed-by: James Simmons Reviewed-by: Andreas Dilger --- lustre/tests/sanity.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 1996346..45cc115 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -4159,6 +4159,8 @@ test_43a() { cp -p $(which sleep) $DIR/$tdir/sleep || error "can't copy" $DIR/$tdir/sleep 60 & SLEEP_PID=$! + # Make sure exec of $tdir/sleep wins race with truncate + sleep 1 $MULTIOP $DIR/$tdir/sleep Oc && error "expected error, got success" kill $SLEEP_PID } @@ -4171,6 +4173,8 @@ test_43b() { cp -p $(which sleep) $DIR/$tdir/sleep || error "can't copy" $DIR/$tdir/sleep 60 & SLEEP_PID=$! + # Make sure exec of $tdir/sleep wins race with truncate + sleep 1 $TRUNCATE $DIR/$tdir/sleep 0 && error "expected error, got success" kill $SLEEP_PID } -- 1.8.3.1