From patchwork Fri Apr 29 07:32:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cheng Li X-Patchwork-Id: 1624023 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4KqPNk2nDlz9sBB for ; Fri, 29 Apr 2022 17:33:26 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id E339F41C1A; Fri, 29 Apr 2022 07:33:24 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id X18gcJKqApct; Fri, 29 Apr 2022 07:33:23 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id BAA0041609; Fri, 29 Apr 2022 07:33:20 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 87948C0032; Fri, 29 Apr 2022 07:33:20 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 4B96DC002D for ; Fri, 29 Apr 2022 07:33:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 282B8611E4 for ; Fri, 29 Apr 2022 07:33:18 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RnJzWUl7FGFl for ; Fri, 29 Apr 2022 07:33:17 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from chinatelecom.cn (prt-mail.chinatelecom.cn [42.123.76.223]) by smtp3.osuosl.org (Postfix) with ESMTP id C8AB1611E2 for ; Fri, 29 Apr 2022 07:33:16 +0000 (UTC) HMM_SOURCE_IP: 172.18.0.218:39912.1134231764 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-36.111.64.85 (unknown [172.18.0.218]) by chinatelecom.cn (HERMES) with SMTP id 1402E2800AD; Fri, 29 Apr 2022 15:33:13 +0800 (CST) X-189-SAVE-TO-SEND: +lic121@chinatelecom.cn Received: from ([172.18.0.218]) by app0025 with ESMTP id 999d11ac707e4160afaedf98a1e574ef for dev@openvswitch.org; Fri, 29 Apr 2022 15:33:15 CST X-Transaction-ID: 999d11ac707e4160afaedf98a1e574ef X-Real-From: lic121@chinatelecom.cn X-Receive-IP: 172.18.0.218 X-MEDUSA-Status: 0 From: lic121 To: dev@openvswitch.org, amorenoz@redhat.com Date: Fri, 29 Apr 2022 07:32:44 +0000 Message-Id: <1651217564-14168-1-git-send-email-lic121@chinatelecom.cn> X-Mailer: git-send-email 1.8.3.1 Subject: [ovs-dev] [PATCH v2] ofproto-dpif-xlate: remove mirror assert X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" During the revalidation/upcall, mirror could be removed. Instead of crash the process, we can simply skip the deleted mirror. The issue had been triggered multiple times by ovs-tcpdump in my test. Fixes: ec7ceaed4f3e ("ofproto-dpif: Modularize mirror code.") Signed-off-by: lic121 Tested-by: Adrian Moreno --- ofproto/ofproto-dpif-xlate.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index 5a770f1..8a5632d 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -2142,9 +2142,14 @@ mirror_packet(struct xlate_ctx *ctx, struct xbundle *xbundle, int snaplen; /* Get the details of the mirror represented by the rightmost 1-bit. */ - ovs_assert(mirror_get(xbridge->mbridge, raw_ctz(mirrors), - &vlans, &dup_mirrors, - &out, &snaplen, &out_vlan)); + if (OVS_UNLIKELY(!mirror_get(xbridge->mbridge, raw_ctz(mirrors), + &vlans, &dup_mirrors, + &out, &snaplen, &out_vlan))) { + /* The mirror got reconfigured before we got to read it's + * configuration. */ + mirrors = zero_rightmost_1bit(mirrors); + continue; + } /* If this mirror selects on the basis of VLAN, and it does not select