All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] netns_netlink: ensure child opens socket before parent creates tap if
@ 2022-04-08 11:26 Jan Stancek
  2022-04-14 13:57 ` Cyril Hrubis
  2022-04-14 15:29 ` Petr Vorel
  0 siblings, 2 replies; 5+ messages in thread
From: Jan Stancek @ 2022-04-08 11:26 UTC (permalink / raw)
  To: ltp

There's a race, that allows parent to create/destroy tap interface
before child manages to open a netlink socket, and then child
will miss all events and test fails:
  tst_kconfig.c:82: TINFO: Parsing kernel config '/lib/modules/5.18.0-rc1/build/.config'
  tst_test.c:1456: TINFO: Timeout per run is 0h 10m 00s
  netns_netlink.c:88: TFAIL: failed to detect interface changes

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 testcases/kernel/containers/netns/netns_netlink.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/containers/netns/netns_netlink.c b/testcases/kernel/containers/netns/netns_netlink.c
index 7c90fb075ff9..6f60ff94ef6c 100644
--- a/testcases/kernel/containers/netns/netns_netlink.c
+++ b/testcases/kernel/containers/netns/netns_netlink.c
@@ -57,7 +57,7 @@ static void child_func(void)
 	SAFE_BIND(fd, (struct sockaddr *) &sa, sizeof(sa));
 
 	/* waits for parent to create an interface */
-	TST_CHECKPOINT_WAIT(0);
+	TST_CHECKPOINT_WAKE_AND_WAIT(0);
 
 	/*
 	 * To get rid of "resource temporarily unavailable" errors
@@ -98,6 +98,9 @@ static void test_netns_netlink(void)
 	if (SAFE_FORK() == 0)
 		child_func();
 
+	/* wait until child opens netlink socket */
+	TST_CHECKPOINT_WAIT(0);
+
 	/* creates TAP network interface dummy0 */
 	if (WEXITSTATUS(system("ip tuntap add dev dummy0 mode tap")))
 		tst_brk(TBROK, "adding interface failed");
-- 
2.27.0


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

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

* Re: [LTP] [PATCH] netns_netlink: ensure child opens socket before parent creates tap if
  2022-04-08 11:26 [LTP] [PATCH] netns_netlink: ensure child opens socket before parent creates tap if Jan Stancek
@ 2022-04-14 13:57 ` Cyril Hrubis
  2022-04-14 15:29 ` Petr Vorel
  1 sibling, 0 replies; 5+ messages in thread
From: Cyril Hrubis @ 2022-04-14 13:57 UTC (permalink / raw)
  To: Jan Stancek; +Cc: ltp

Hi!
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

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

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

* Re: [LTP] [PATCH] netns_netlink: ensure child opens socket before parent creates tap if
  2022-04-08 11:26 [LTP] [PATCH] netns_netlink: ensure child opens socket before parent creates tap if Jan Stancek
  2022-04-14 13:57 ` Cyril Hrubis
@ 2022-04-14 15:29 ` Petr Vorel
  2022-04-19  6:36   ` Petr Vorel
  1 sibling, 1 reply; 5+ messages in thread
From: Petr Vorel @ 2022-04-14 15:29 UTC (permalink / raw)
  To: Jan Stancek; +Cc: ltp

Hi Jan,

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr

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

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

* Re: [LTP] [PATCH] netns_netlink: ensure child opens socket before parent creates tap if
  2022-04-14 15:29 ` Petr Vorel
@ 2022-04-19  6:36   ` Petr Vorel
  2022-04-19 10:38     ` Jan Stancek
  0 siblings, 1 reply; 5+ messages in thread
From: Petr Vorel @ 2022-04-19  6:36 UTC (permalink / raw)
  To: Jan Stancek, ltp

Hi Jan,

Merged your fix, thanks!

Kind regards,
Petr

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

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

* Re: [LTP] [PATCH] netns_netlink: ensure child opens socket before parent creates tap if
  2022-04-19  6:36   ` Petr Vorel
@ 2022-04-19 10:38     ` Jan Stancek
  0 siblings, 0 replies; 5+ messages in thread
From: Jan Stancek @ 2022-04-19 10:38 UTC (permalink / raw)
  To: Petr Vorel; +Cc: LTP List

On Tue, Apr 19, 2022 at 8:36 AM Petr Vorel <pvorel@suse.cz> wrote:
>
> Hi Jan,
>
> Merged your fix, thanks!

Thanks, I was just looking for this email, but you were faster :-)

>
> Kind regards,
> Petr
>


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

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

end of thread, other threads:[~2022-04-19 10:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-08 11:26 [LTP] [PATCH] netns_netlink: ensure child opens socket before parent creates tap if Jan Stancek
2022-04-14 13:57 ` Cyril Hrubis
2022-04-14 15:29 ` Petr Vorel
2022-04-19  6:36   ` Petr Vorel
2022-04-19 10:38     ` Jan Stancek

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.