From patchwork Tue Sep 10 12:49:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Simonart X-Patchwork-Id: 1983228 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=C8s14G0G; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X33SM04lKz1y1S for ; Tue, 10 Sep 2024 22:49:37 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 25ECC6070C; Tue, 10 Sep 2024 12:49:35 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id hCO2K6JnKljr; Tue, 10 Sep 2024 12:49:34 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.9.56; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 09C81605EC Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=C8s14G0G Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 09C81605EC; Tue, 10 Sep 2024 12:49:34 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id E34F4C0012; Tue, 10 Sep 2024 12:49:33 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2D8A1C0011 for ; Tue, 10 Sep 2024 12:49:33 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 1014F80DB1 for ; Tue, 10 Sep 2024 12:49:33 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id EXJSCNAj8GPJ for ; Tue, 10 Sep 2024 12:49:32 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.133.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=xsimonar@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 34D1880D9B Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 34D1880D9B Authentication-Results: smtp1.osuosl.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=C8s14G0G Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id 34D1880D9B for ; Tue, 10 Sep 2024 12:49:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725972570; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cLd+NL040MTBwvBtLaMm3v2LYCNIrhx7exbtUHn3g08=; b=C8s14G0GMeP2p0q4iV3zM7Jzmz+ArZMgT6ypLQ/CBX0HtLNj4fd3b+q1DCP8wxuoY2r4gH XFl2BPNiFxya7dMdt6jW2+8f7vEIJooG2jfluz+4n6Fk97Ei7JOx1OmpFPHu9AaG8/68lp dcBiIrSp6nijrN/cAST1p2EYqVqUGac= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-464-N3HdDHbOPXWtC_bGSQzT-Q-1; Tue, 10 Sep 2024 08:49:29 -0400 X-MC-Unique: N3HdDHbOPXWtC_bGSQzT-Q-1 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8D9C81956083 for ; Tue, 10 Sep 2024 12:49:28 +0000 (UTC) Received: from wsfd-netdev90.ntdv.lab.eng.bos.redhat.com (wsfd-netdev90.anl.eng.rdu2.dc.redhat.com [10.6.38.135]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0BC9319560AD; Tue, 10 Sep 2024 12:49:27 +0000 (UTC) From: Xavier Simonart To: xsimonar@redhat.com, dev@openvswitch.org Date: Tue, 10 Sep 2024 14:49:27 +0200 Message-Id: <20240910124927.2653061-1-xsimonar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn] binding: Fix race condition when claiming vif. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" When a vif is claimed, chassis is written in sb Port Binding. If some vif update was received by the controller before the sb notification of the chassis update (i.e. while pb->chassis = NULL), the port was considered as TRACKED_REMOVED and ct_zone was flushed. When, later, the pb->chassis update was received, ct_zone was flushed again. This issue seems to only have as side effect a few extra ct_zone flush while the port is getting added. The fix avoid the extra bump in the claim process and hence avoids the unnecessary additional ct_flush. This issue was causing some flaky failures of test "Migration of CT zone from UUID to name" as unexpected ct_zone flus happened. Signed-off-by: Xavier Simonart Acked-by: Ales Musil --- controller/binding.c | 2 +- tests/system-ovn.at | 73 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 1 deletion(-) diff --git a/controller/binding.c b/controller/binding.c index bfdeb99b9..72c2845ca 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -1620,7 +1620,7 @@ consider_vif_lport_(const struct sbrec_port_binding *pb, b_ctx_out->if_mgr); } } - if (pb->chassis != b_ctx_in->chassis_rec + if (pb->chassis && pb->chassis != b_ctx_in->chassis_rec && !is_requested_additional_chassis(pb, b_ctx_in->chassis_rec) && if_status_is_port_claimed(b_ctx_out->if_mgr, pb->logical_port)) { diff --git a/tests/system-ovn.at b/tests/system-ovn.at index 78020ecda..05edc3148 100644 --- a/tests/system-ovn.at +++ b/tests/system-ovn.at @@ -13878,3 +13878,76 @@ OVS_TRAFFIC_VSWITCHD_STOP(["/.*error receiving.*/d /.*terminating with signal 15.*/d"]) AT_CLEANUP ]) + +OVN_FOR_EACH_NORTHD([ +AT_SETUP([NXT_CT_FLUSH_ZONE count]) +ovn_start --use-tcp-to-sb +OVS_TRAFFIC_VSWITCHD_START() +ADD_BR([br-int]) + +dnl Set external-ids in br-int needed for ovn-controller +PARSE_LISTENING_PORT([$ovs_base/ovn-sb/ovsdb-server.log], [TCP_PORT]) +check ovs-vsctl \ + -- set Open_vSwitch . external-ids:system-id=hv1 \ + -- set Open_vSwitch . external-ids:ovn-remote=tcp:127.0.0.1:$TCP_PORT \ + -- set Open_vSwitch . external-ids:ovn-encap-type=geneve \ + -- set Open_vSwitch . external-ids:ovn-encap-ip=169.0.0.1 \ + -- set bridge br-int fail-mode=secure other-config:disable-in-band=true + +dnl Start ovn-controller +start_daemon ovn-controller +check ovn-appctl -t ovn-controller vlog/set dbg:ct_zone + +# sw0-port1 -- sw0 + +check ovn-nbctl ls-add sw0 +check ovn-nbctl lsp-add sw0 sw0-port1 + +# Make sure address is set in a different transaction. +sleep_sb +stop_ovsdb_controller_updates $TCP_PORT +check ovn-nbctl lsp-set-addresses sw0-port1 "50:54:00:00:00:01 192.168.0.2" + +ovs-vsctl add-port br-int p1 -- \ + set Interface p1 external_ids:iface-id=sw0-port1 -- set Interface p1 type=internal + +# Make sure ovn-controller runs and claims the port. +ensure_controller_run + +# Wake up sb, so that it can handle lsp-set-address, but no the pb->chassis (as updates from controller stillblocked) +wake_up_sb +ensure_controller_run + +# And now restarts ovn-controller. +restart_ovsdb_controller_updates $TCP_PORT + +wait_for_ports_up +ovn-nbctl --wait=hv sync + +AT_CHECK([ovn-appctl -t ovn-controller ct-zone-list | sed "s/ [[0-9]]*/ ??/" | sort], [0], [dnl +sw0-port1 ?? +sw0_dnat ?? +sw0_snat ?? +]) + +# Check that we did just the initial zone flush +AT_CHECK([grep -c "NXT_CT_FLUSH_ZONE" ovs-vswitchd.log], [0], [dnl +3 +]) + +OVS_APP_EXIT_AND_WAIT([ovn-controller]) + +as ovn-sb +OVS_APP_EXIT_AND_WAIT([ovsdb-server]) + +as ovn-nb +OVS_APP_EXIT_AND_WAIT([ovsdb-server]) + +as northd +OVS_APP_EXIT_AND_WAIT([ovn-northd]) + +as +OVS_TRAFFIC_VSWITCHD_STOP(["/.*error receiving.*/d +/.*terminating with signal 15.*/d"]) +AT_CLEANUP +])