Skip to contentSkip to conversation

syscalls/fcntl15: Wait until child processes did its work

PATCH In review Fabian Vogt 2 participants 2 messages Dec 13, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 syscalls/fcntl15: Wait until child processes did its work

The child process might not have completed locking region two when the parent expectes it to. Wait for it.

Fixes 079de87f9522 ("syscalls/fcntl15: Convert to new API")
---
 testcases/kernel/syscalls/fcntl/fcntl15.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
testcases/kernel/syscalls/fcntl/fcntl15.c +4 -1
index 59328605ac2b..82dee4b21ee2 100644
@@ -75,7 +75,7 @@ static void lock_region_two(int file_flag, int file_mode)
 
 	SAFE_FCNTL(fd, F_SETLK, &lock_two);
 
-	TST_CHECKPOINT_WAIT(1);
+	TST_CHECKPOINT_WAKE_AND_WAIT(1);
 
 	SAFE_CLOSE(fd);
 }
@@ -143,8 +143,11 @@ static int run_test(int file_flag, int file_mode, int dup_flag)
 
 	SAFE_FCNTL(fd[0], F_SETLK, &lock_one);
 
+	// Lock region two or wait until the child locked it
 	if (dup_flag != FORK_)
 		SAFE_FCNTL(fd[1], F_SETLK, &lock_two);
+	else
+		TST_CHECKPOINT_WAIT(1);
 
 	if (!SAFE_FORK()) {
 		do_test(file_flag, file_mode, dup_flag);
Signature · 8 lines
2.33.1





-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

Hi!
Good catch. I've adjusted the commit message a bit and pushed, thanks.

Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp