From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.219.41 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796549385; b=hzoBbaqbjraxwSXbQywUJX/lrlTtKKgpkLMst+9et7ug7uF2lVKEUaI1ELr361acT7Gv 9WmSlMSDM+WYzSGDqn1z7tbuN9RqW/dxGIj+DJlO4UC2b19smSOjp8soKW9hWeTMHALaf Fj8Y5/3doVBZanVTTHkLf5tJ8h7IZ2BBXhcOL0sLczGu7FD18wb2ucJi0s9nI/kvPDEOZ hiZhUKkl47iSzy288Nhoy76f6TrHRxG30EMmyHVCQfMpdHeaflgdcdYOt9P+iG7p8k49B 7LRoR5XSgCTy4VkT+TIMEkHM8tW25lO7QJkaArAR6GMBSNpZGO+GK6aVnqShx7ApJUg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796549385; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding; bh=NeIBPV7teczF0XDX7q5VFzAnBP4tfnBhthX4+kstXlQ=; b=izpC9Sye6BwNC+GZWFrNy3WLi1VGRQ2q3Y0KaGSv1KIuVtaUqMAjvR81lG37BXT5CS8C oL1SW+eSLK+hIzKkbdNjU5KtzpQjrdtyBnwgiufhKKH7c4OTlEreUNuVWSBi7ArRBi5mJ OXWeWEbHVMysBf4FoWWOtNcclzXlI274tg69QnIrII3g2PAnlx7o2/Sf6CgUakA+bzeAQ hrIfRAYP6fZIltCmOYkHKA9yj8ZkORYIcg5mA3Nkffr/4hardfN2MF1OkHHgDjpE/xHDF rByZTUUQ+AOR0TzjB0kmrEi37AZofsu6IWx6JVwDhYYa10hihgpcSUn+249PEzLYIyA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=lmArNtrb; arc=none smtp.remote-ip=209.85.219.41 Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com [209.85.219.41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BEB8B606A31F for ; Sun, 6 Dec 2026 09:29:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BEB8B606A31F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=lmArNtrb Received: by mail-qv1-f41.google.com with SMTP id 6a1803df08f44-921d1820958so48470116d6.1 for ; Sun, 06 Dec 2026 01:29:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796549384; x=1797154184; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=NeIBPV7teczF0XDX7q5VFzAnBP4tfnBhthX4+kstXlQ=; b=lmArNtrbezn2BLcyMnB0WZ/JsCv4yuitTffuGg5UENhDYb8btubicSnk20+1WPzgtZ FLZAPHDefszFOGLk+97qHnJ9u3D//V6iC5ZV2pni7nHJMKnT6Qz6WV7BsZYxEpReYfYL 7D0yTWgQ4nwN7yeb7iMdO/xJEfllhOvILeN8Z2O824YOQxB/WXdpbGa6byo+Wsvc1n3/ iCm20hJ/Kab2NndPbRsZYyn9dIIfiUEOjGv786El07HgxsZsm6d7HZYb3494tOnFcbmQ +JcGm9pogRYjbGbOe37ZTN1RZ6ZAOkiVMvNRBw5BJqKptWxNP07bQ2l9pOg185BMQr2M LE/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796549384; x=1797154184; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=NeIBPV7teczF0XDX7q5VFzAnBP4tfnBhthX4+kstXlQ=; b=dK9KfDdDhTCRh0ahxLqrVbkYp0SO9zDy0xbIpH67pC+/rz/lP4u8i77+ZRd2r/GDY1 JQIOu7rt8pi8tBWLzrsAKixD9gbG0zA8NKXo+mVsIbzUrAY6JMhCH4dEr4tdcimd00q9 +eemrsCLUD4VdUsF/rS2S9nYun5MZNd5MQaJl5LPSgJ/leTtor2Kk0tJ57KShOHsPPbg /RFOO/sN5BWVS227rrYpPneLr3JYQtOO+DvnFwUM/ovhacfubgpS99/uch1VknF+pJL8 6qIk0bzW5xO5lqK7K5fpE1BJzK/PYfY8kEMZhvCBaeDPFQ8Cib9lBhJ842m/NcxOjmAb vqmA== X-Gm-Message-State: AB4q+uGS1wJTcTaVkBjWex0b7vXvVdK0DAxTeuf/8cRfB8Ac0G3uiBtf QvM2WVPvxXUm7vL0jojjzHWkN6oDH70/qkvb7X7MRtbtbDW41/TUd72JLkNKJB+uRLXChw== X-Gm-Gg: AZFdTZeMkfwPPQyXcgNg3rQdj9ei6w66fMsQCDXHl374U+MSHhqPqvMugtmFsNpJ2Lu viy9RB/AbeQvQHj7erYuEV9P142f701dHNilylWoHccljAhx28ehFdT31qHOYkaB5oU84TW2uCO J0xnoI9Tkbt60eWb1PALq8nkpD50gOWH40fhOw4Lr8OLm3wTzmU32GEYfmIMCUXOn2IrLVy/xDR Gey2KpUEaEQWofXqRTYlD4au5a/kf4SC9aUa8sGgFi6/db+yMdoXeAcRVHKsf5tQPw5R01OYKTO FGD+4nXEVcooeeAzuIkXqzLXKTx9Yhzt/34Gc4OgrGIxJsVAEH8IUzOuIyvJTqLcG8ft0KTOhNP 8Ce7Z2tgKLKPj/vhhtFKAZT/AHr6yNH+9A+7hfM+VMwMOGSMnetwNpv6GAf8ISGe8JqjlkSVBdk qC5ays7116Okj8nBDSAdSUaDNX7R77WD5oDu5lHWoRpafLgoxDrgAOY/foytdMmVT6S9P4k/vSi 0HcT5fi+lKiH/n6ka6OSLIUlB2EAtoh52f8DWfQc0NAxmRNyOSuY6ks3+mKpIwqxYsl5+EqhVFL hGy/NiDufkbnaCHtQ2/Qr124/9v9sGllUGdK9mjwNqKtw06H/smZczUqnxERIVIBIc/o2ux6QL7 SdLwdnA== X-Received: by 2002:ad4:5966:0:b0:921:3439:58d4 with SMTP id 6a1803df08f44-921d50a539amr160138096d6.36.1796549383673; Sun, 06 Dec 2026 01:29:43 -0800 (PST) Received: from houminxi ([61.170.180.148]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-921e04e271bsm64311586d6.5.2026.12.06.01.29.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Dec 2026 01:29:42 -0800 (PST) From: Minxi Hou To: netdev@vger.kernel.org Cc: Aaron Conole , Eelco Chaudron , Ilya Maximets , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Willem de Bruijn , Simon Horman , Shuah Khan , dev@openvswitch.org, linux-kselftest@vger.kernel.org, Ilya Maximets Subject: [PATCH net-next v1 1/1] selftests/net/openvswitch: terminate namespace processes before deletion Date: Sun, 6 Dec 2026 04:29:27 -0500 Message-ID: <20261206092927.2282478-1-houminxi@gmail.com> X-Mailer: git-send-email 2.56.1 X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ovs_netns_spawn_daemon() records only the PID of the process it starts. A daemon such as socat with the fork option can leave children behind when cleanup terminates that PID. Deleting the namespace name does not terminate the remaining processes, so a live child can keep the network namespace alive after the test exits. Send SIGTERM to the processes in each test namespace and use the existing bounded wait before deleting its name. Keep the sweep before deletion, while ip netns pids can still find the namespace's processes. Cleanup remains best effort if a process does not exit within the timeout. Fixes: 07a9e3975039 ("selftests/net/openvswitch: add SCTP flow key support and test") Signed-off-by: Minxi Hou --- Testing: all 19 registered OVS selftest cases passed in a fresh guest on a reused 7.4.0-rc4-virtme kernel and matching OVS module. The suite completed in 155.074 seconds. No matching test processes remained during the 10-second post-suite observation; datapaths and named namespaces were empty, and the OVS module unloaded. The userspace sources are from this base plus the patch; the kernel was not rebuilt from this base. A controlled real SCTP connection reproduced the cleanup defect: with only the new cleanup registration withdrawn, a forked listener child remained alive for 10 seconds. The fixed and restored copies drained the namespace. Natural withdrawal runs did not reliably reproduce the original intermittent leak. AI assistance: Hermes assisted with diagnosis, the cleanup helper, test execution and this message. The task was to clean up processes left by the OVS selftests without changing their forwarding tests. .../selftests/net/openvswitch/openvswitch.sh | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/openvswitch/openvswitch.sh b/tools/testing/selftests/net/openvswitch/openvswitch.sh index 21444657a04049c293ad8b875f89602eeb9218aa..01f1f56608147caeecc3c40614fc4a156cff1e7c 100755 --- a/tools/testing/selftests/net/openvswitch/openvswitch.sh +++ b/tools/testing/selftests/net/openvswitch/openvswitch.sh @@ -68,6 +68,24 @@ ovs_wait() { return 1 } +# Called indirectly by ovs_wait during namespace cleanup. +# shellcheck disable=SC2329 +ovs_netns_pids_gone() { + [ -z "$(ip netns pids "$1" 2>/dev/null)" ] +} + +# Registered as a deferred command by ovs_add_netns_and_veths. +# shellcheck disable=SC2329 +ovs_cleanup_netns() { + local netns=$1 + local pid + + for pid in $(ip netns pids "$netns" 2>/dev/null); do + kill -TERM "$pid" 2>/dev/null || true + done + ovs_wait ovs_netns_pids_gone "$netns" || true +} + ovs_base=`pwd` sbxs= sbx_add () { @@ -160,10 +178,12 @@ ovs_spawn_daemon() { ovs_netns_spawn_daemon $sbx "_default" $* } +# Called by test functions dispatched indirectly by run_test. +# shellcheck disable=SC2329 ovs_add_netns_and_veths () { info "Adding netns attached: sbx:$1 dp:$2 {$3, $4, $5}" ovs_sbx "$1" ip netns add "$3" || return 1 - on_exit "ovs_sbx $1 ip netns del $3" + on_exit "ovs_sbx $1 ovs_cleanup_netns $3; ovs_sbx $1 ip netns del $3" ovs_sbx "$1" ip link add "$4" type veth peer name "$5" || return 1 on_exit "ovs_sbx $1 ip link del $4 >/dev/null 2>&1" ovs_sbx "$1" ip link set "$4" up || return 1 base-commit: 76c4fde2458287eb92924f35fe7888e5fc427ed5