All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] syscalls/recvmsg01: wait for server to finish
@ 2022-05-06  9:14 Jan Stancek
  2022-05-06 11:02 ` Petr Vorel
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Stancek @ 2022-05-06  9:14 UTC (permalink / raw)
  To: ltp

When test finishes, cleanup of temporary directory (by library)
can be racing with server process still running sender() function
and trying to clean temp file "smtXXXXXX":
    ...
    recvmsg01   12  TPASS  :  large cmesg length successful
    recvmsg01    0  TWARN  :  tst_tmpdir.c:343: tst_rmdir: rmobj(/mnt/testarea/ltp-jj3j87RyWN/recnDC6uq)
                              failed: unlink(/mnt/testarea/ltp-jj3j87RyWN/recnDC6uq/smtlCpMTv)
                              failed; errno=2: ENOENT

Wait for server pid before proceeding with test cleanup.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 testcases/kernel/syscalls/recvmsg/recvmsg01.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/recvmsg/recvmsg01.c b/testcases/kernel/syscalls/recvmsg/recvmsg01.c
index 13bcaa4e07c4..6b78a230ba04 100644
--- a/testcases/kernel/syscalls/recvmsg/recvmsg01.c
+++ b/testcases/kernel/syscalls/recvmsg/recvmsg01.c
@@ -268,8 +268,10 @@ void setup(void)
 
 void cleanup(void)
 {
-	if (pid > 0)
+	if (pid > 0) {
 		(void)kill(pid, SIGKILL);	/* kill server */
+		wait(NULL);
+	}
 	if (tmpsunpath[0] != '\0')
 		(void)unlink(tmpsunpath);
 	tst_rmdir();
-- 
2.27.0


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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-09  7:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-06  9:14 [LTP] [PATCH] syscalls/recvmsg01: wait for server to finish Jan Stancek
2022-05-06 11:02 ` Petr Vorel
2022-05-09  7:25   ` Li Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.