From: Li Wang <li.wang@linux.dev>
To: Cyril Hrubis <chrubis@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v1 23/31] testcases: sysfs: Add sys_net04
Date: Wed, 19 Aug 2026 10:13:12 +0800 [thread overview]
Message-ID: <aoUROJGM1mDGTqjA@linux.dev> (raw)
In-Reply-To: <20260818141311.1265557-24-chrubis@suse.cz>
> +static void run(void)
> +{
> + struct netdev_state s0, s1, s2;
> +
> + read_state(&s0);
> + check_state(&s0, 1, "up", "tun attached and up");
> +
> + SAFE_CLOSE(tun_fd);
Here I got intermittent fails in local test:
sys_net_common.h:32: TFAIL: st->operstate (up) != operstate (down)
The possible reason is kernel asynchronous update race condition.
The test reads operstate immediately after closing the FD, catching
the stale "up" state before the kernel's background workqueue has
time to update it to "down".
Maybe we can add a polling mechanism with a timeout to wait for
the operstate to transition.
--- a/testcases/kernel/sysfs/class/net/sys_net04.c
+++ b/testcases/kernel/sysfs/class/net/sys_net04.c
@@ -153,6 +153,12 @@ static void check_tun_vs_tap_type(void)
TST_SYSFS_EXP_EQ_LI(6, "/sys/class/net/" IFNAME_TAP "/addr_len");
}
+static int check_operstate(struct netdev_state *st, const char *expected_state)
+{
+ read_state(st);
+ return strcmp(st->operstate, expected_state);
+}
+
static void run(void)
{
struct netdev_state s0, s1, s2;
@@ -161,12 +167,14 @@ static void run(void)
check_state(&s0, 1, "up", "tun attached and up");
SAFE_CLOSE(tun_fd);
+ TST_RETRY_FUNC(check_operstate(&s1, "down"), !);
read_state(&s1);
check_state(&s1, 0, "down", "tun detached");
check_state_delta(&s0, &s1, 0, 1, "detach transition");
tun_fd = open_tun(IFNAME_TUN, IFF_TUN | IFF_NO_PI);
read_state(&s2);
+ TST_RETRY_FUNC(check_operstate(&s2, "up"), !);
check_state(&s2, 1, "up", "tun reattached");
check_state_delta(&s1, &s2, 1, 0, "reattach transition");
> + read_state(&s1);
> + check_state(&s1, 0, "down", "tun detached");
> + check_state_delta(&s0, &s1, 0, 1, "detach transition");
> +
> + tun_fd = open_tun(IFNAME_TUN, IFF_TUN | IFF_NO_PI);
> + read_state(&s2);
> + check_state(&s2, 1, "up", "tun reattached");
Here also fail:
sys_net_common.h:32: TFAIL: st->operstate (down) != operstate (up)
> + check_state_delta(&s1, &s2, 1, 0, "reattach transition");
> +
> + check_mtu_valid(68);
> + check_mtu_valid(1500);
> + check_mtu_valid(9000);
> + check_mtu_valid(65535);
> + check_mtu_invalid("-1");
> + check_mtu_invalid("0");
> + check_mtu_invalid("67");
> + check_mtu_invalid("70000");
> +
> + check_tun_flags();
> + check_owner_group();
> + check_tun_vs_tap_type();
> +}
--
Regards,
Li Wang
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-08-19 2:13 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-18 14:12 [LTP] [PATCH v1 00/31] Add sysfs sanity tests Cyril Hrubis
2026-08-18 14:12 ` [LTP] [PATCH v1 01/31] lib: Add tst_sysfs_assert Cyril Hrubis
2026-08-18 14:12 ` [LTP] [PATCH v1 02/31] testcases: sysfs: Add sys_power01 Cyril Hrubis
2026-08-18 14:12 ` [LTP] [PATCH v1 03/31] testcases: sysfs: Add sys_kernel01 Cyril Hrubis
2026-08-18 14:54 ` [LTP] lib: Add tst_sysfs_assert linuxtestproject.agent
2026-08-18 14:12 ` [LTP] [PATCH v1 04/31] testcases: sysfs: Add sys_clocksource01 Cyril Hrubis
2026-08-18 14:12 ` [LTP] [PATCH v1 05/31] testcases: sysfs: Add sys_node01 Cyril Hrubis
2026-08-18 14:12 ` [LTP] [PATCH v1 06/31] testcases: sysfs: Add sys_cpu_topology01 Cyril Hrubis
2026-08-18 14:12 ` [LTP] [PATCH v1 07/31] testcases: sysfs: Add sys_cpu_topology02 Cyril Hrubis
2026-08-18 14:12 ` [LTP] [PATCH v1 08/31] testcases: sysfs: Add sys_cpu_vulnerabilities01 Cyril Hrubis
2026-08-18 14:12 ` [LTP] [PATCH v1 09/31] testcases: sysfs: Add sys_cpu_smt01 Cyril Hrubis
2026-08-18 14:12 ` [LTP] [PATCH v1 10/31] testcases: sysfs: Add sys_cpu_cache01 Cyril Hrubis
2026-08-18 14:12 ` [LTP] [PATCH v1 11/31] testcases: sysfs: Add sys_clockevents01 Cyril Hrubis
2026-08-18 14:12 ` [LTP] [PATCH v1 12/31] testcases: sysfs: Add sys_ata01 Cyril Hrubis
2026-08-18 14:12 ` [LTP] [PATCH v1 13/31] testcases: sysfs: Add sys_bdi01 Cyril Hrubis
2026-08-18 14:12 ` [LTP] [PATCH v1 14/31] testcases: sysfs: sys_hwmon01 Cyril Hrubis
2026-08-18 14:12 ` [LTP] [PATCH v1 15/31] testcases: sysfs: sys_leds01 Cyril Hrubis
2026-08-18 14:12 ` [LTP] [PATCH v1 16/31] testcases: sysfs: Add sys_wakeup01 Cyril Hrubis
2026-08-18 14:12 ` [LTP] [PATCH v1 17/31] testcases: sysfs: Add sys_rtc01 Cyril Hrubis
2026-08-18 14:12 ` [LTP] [PATCH v1 18/31] testcases: sysfs: Add sys_thermal01 Cyril Hrubis
2026-08-18 14:12 ` [LTP] [PATCH v1 19/31] tst_netdevice: Add two more helper macros Cyril Hrubis
2026-08-18 14:13 ` [LTP] [PATCH v1 20/31] testcases: sysfs: Add sys_net01 Cyril Hrubis
2026-08-18 14:13 ` [LTP] [PATCH v1 21/31] testcases: sysfs: Add sys_net02 Cyril Hrubis
2026-08-18 14:13 ` [LTP] [PATCH v1 22/31] testcases: sysfs: Add sys_net03 Cyril Hrubis
2026-08-18 14:13 ` [LTP] [PATCH v1 23/31] testcases: sysfs: Add sys_net04 Cyril Hrubis
2026-08-19 2:13 ` Li Wang [this message]
2026-08-19 2:27 ` Li Wang
2026-08-18 14:13 ` [LTP] [PATCH v1 24/31] testcases: sysfs: Add sys_block_loop01 Cyril Hrubis
2026-08-18 14:13 ` [LTP] [PATCH v1 25/31] testcases: sysfs: Add sys_block_queue01 Cyril Hrubis
2026-08-18 14:13 ` [LTP] [PATCH v1 26/31] testcases: sysfs: Add sys_block_size01 Cyril Hrubis
2026-08-18 14:13 ` [LTP] [PATCH v1 27/31] testcases: sysfs: Add sys_hugepages01 Cyril Hrubis
2026-08-18 14:13 ` [LTP] [PATCH v1 28/31] testcases: sysfs: Add sys_hugepages02 Cyril Hrubis
2026-08-18 14:13 ` [LTP] [PATCH v1 29/31] testcases: sysfs: Add sys_ksm01 Cyril Hrubis
2026-08-18 14:13 ` [LTP] [PATCH v1 30/31] testcases: sysfs: Add sys_swap01 Cyril Hrubis
2026-08-19 1:23 ` Li Wang
2026-08-18 14:13 ` [LTP] [PATCH v1 31/31] testcases: sysfs: Add sys_thp01 Cyril Hrubis
2026-08-19 7:46 ` [LTP] [PATCH v1 00/31] Add sysfs sanity tests Jan Stancek via ltp
2026-08-19 7:55 ` Cyril Hrubis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aoUROJGM1mDGTqjA@linux.dev \
--to=li.wang@linux.dev \
--cc=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox