Re: [PATCH net v2 2/2] selftests: openvswitch: add tests for tunnel vport refcounting

Ilya Maximets
2026-05-05T13:28:31Z

On 5/5/26 3:25 PM, Paolo Abeni wrote:
> On 5/1/26 1:38 AM, Ilya Maximets wrote:
>> @@ -830,6 +831,42 @@ test_tunnel_metadata() {
>> return 0
>> }
>>
>> +test_tunnel_refcount() {
>> + sbxname="test_tunnel_refcount"
>> + sbx_add "${sbxname}" || return 1
>> +
>> + ovs_sbx "${sbxname}" ip netns add trefns || return 1
>> + on_exit "ovs_sbx ${sbxname} ip netns del trefns"
>> +
>> + for tun_type in gre vxlan geneve; do
>> + info "testing ${tun_type} tunnel vport refcount"
>> +
>> + ovs_sbx "${sbxname}" ip netns exec trefns \
>> + python3 $ovs_base/ovs-dpctl.py \
>> + add-dp dp-${tun_type} || return 1
>> +
>> + ovs_sbx "${sbxname}" ip netns exec trefns \
>> + python3 $ovs_base/ovs-dpctl.py \
>> + add-if --no-lwt -t ${tun_type} \
>> + dp-${tun_type} ovs-${tun_type}0 || return 1
>> +
>> + ovs_wait ip -netns trefns link show \
>> + ovs-${tun_type}0 >/dev/null 2>&1 || return 1
>> +
>> + info "deleting dp - may hang if reference counting is broken"
>> + ovs_sbx "${sbxname}" ip netns exec trefns \
>> + python3 $ovs_base/ovs-dpctl.py \
>> + del-dp dp-${tun_type} &
>> +
>> + dev_removed() {
>> + ! ip -netns trefns link show "$1" >/dev/null 2>&1
>> + }
>> + ovs_wait dev_removed dp-${tun_type} || return 1
>> + ovs_wait dev_removed ovs-${tun_type}0 || return 1
>
> FTR, here sashiko laments that if the reference counting is broken and
> the del-dp process hangs, this could leave the background del-dp python
> process running indefinitely.
>
> I guess that if reference counting is broken inside the kernel, very
> likely an host/VM reboot is needed, and the above does not matter.

Yes, I have a note about that in the cover letter.