mirror of
https://github.com/opnsense/src.git
synced 2026-07-15 20:13:02 -04:00
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 (cherry picked from commit f4be16983dea4904f85ac20e921ad2a8c18a0f79)
This commit is contained in:
parent
c624e04a0b
commit
696d159069
1 changed files with 29 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue