aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhenlei Huang <zlei@FreeBSD.org>2026-04-27 19:17:21 +0000
committerZhenlei Huang <zlei@FreeBSD.org>2026-04-27 19:17:21 +0000
commitf4be16983dea4904f85ac20e921ad2a8c18a0f79 (patch)
tree8fb08aecf132af0c24c3812ab617f1a871289666
parent80c73c89dc6a156a119350d7c28c6db1f3b741df (diff)
tests/net/if_clone_test: Add a test for races between if_detach() and if_vmove_reclaim()
Ideally we shall have tests for all possible races. It is races between if_detach(), if_vmove_loan(), if_vmove_reclaim() and vnet_if_return(). Well that requires too many tests and it appears to be less valuable to have them all. So focus on potential in future regressions related to recent fixes [1] and [2] only. [1] ee9456ce3753 ifnet: Fix races in if_vmove_reclaim() [2] ba7f47d47dc1 ifnet: if_detach(): Fix races with vmove operations MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D56606
-rwxr-xr-xtests/sys/net/if_clone_test.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/sys/net/if_clone_test.sh b/tests/sys/net/if_clone_test.sh
index 864ff86a7d44..d636815175b4 100755
--- a/tests/sys/net/if_clone_test.sh
+++ b/tests/sys/net/if_clone_test.sh
@@ -96,6 +96,34 @@ epair_destroy_race_cleanup()
cleanup_ifaces
}
+atf_test_case epair_destroy_race2 cleanup
+epair_destroy_race2_head()
+{
+ atf_set "descr" "Race if_detach() and if_vmove_reclaim()"
+ atf_set "require.user" "root"
+}
+epair_destroy_race2_body()
+{
+ jid=$(jail -ic vnet host.hostname="epair_destroy2" persist path=/)
+
+ for i in `seq 1 10`
+ do
+ epair_a=$(ifconfig epair create)
+ epair_b=${epair_a%a}b
+ ifconfig $epair_b vnet $jid
+ ifconfig $epair_a destroy & pid1=$!
+ ifconfig $epair_b -vnet $jid & pid2=$!
+ wait $pid1
+ wait $pid2
+ done
+
+ jail -R $jid
+ true
+}
+epair_destroy_race2_cleanup()
+{
+}
+
atf_test_case epair_ipv6_up_stress cleanup
epair_ipv6_up_stress_head()
{
@@ -432,6 +460,7 @@ atf_init_test_cases()
atf_add_test_case epair_stress
atf_add_test_case epair_up_stress
atf_add_test_case epair_destroy_race
+ atf_add_test_case epair_destroy_race2
atf_add_test_case faith_ipv6_up_stress
atf_add_test_case faith_stress
atf_add_test_case faith_up_stress