From patchwork Fri Apr 12 01:57:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ihar Hrachyshka X-Patchwork-Id: 1922806 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=ZSYGzJOb; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VG07z1928z1yYM for ; Fri, 12 Apr 2024 11:57:51 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 2E9D841FB2; Fri, 12 Apr 2024 01:57:49 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id jSpTj5pH1pL3; Fri, 12 Apr 2024 01:57:48 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org E728F41F7B Authentication-Results: smtp4.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ZSYGzJOb Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id E728F41F7B; Fri, 12 Apr 2024 01:57:47 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id BD2F1C007C; Fri, 12 Apr 2024 01:57:47 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 5CE31C007C for ; Fri, 12 Apr 2024 01:57:46 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 3595F41BA9 for ; Fri, 12 Apr 2024 01:57:46 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id hTEEpu0R0Zkr for ; Fri, 12 Apr 2024 01:57:43 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=ihrachys@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org 20DCA41B78 Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 20DCA41B78 Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ZSYGzJOb Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id 20DCA41B78 for ; Fri, 12 Apr 2024 01:57:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712887061; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3CzAtKY3GUl1B1wHmsdGRQFWCs3CHIR6JlbZFJNNIGs=; b=ZSYGzJObv74EeQSoaCHrdJd6tepU8xveqFUAq5jpOSBFdqHPBxeWJl7NVWr9leILS1xgqf s3znMovspk6bgeOR21fCYznJsMPVWN3R3I6AO7BsriN8U+YTkESB4NgBpsGbseChFwseft 3uaiQU0JEmp9FppEdDxWtQHKT6wa1+g= Received: from mail-yw1-f200.google.com (mail-yw1-f200.google.com [209.85.128.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-591--UGIEA5BNHGZZPlWUt962Q-1; Thu, 11 Apr 2024 21:57:40 -0400 X-MC-Unique: -UGIEA5BNHGZZPlWUt962Q-1 Received: by mail-yw1-f200.google.com with SMTP id 00721157ae682-6167463c60cso5946967b3.1 for ; Thu, 11 Apr 2024 18:57:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712887059; x=1713491859; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3CzAtKY3GUl1B1wHmsdGRQFWCs3CHIR6JlbZFJNNIGs=; b=TYVLGk7j+5huE8Dc2REA3cV954dsGZ+V8V8JqCVxRyHuWu6umccepltxVktc4WQw0R JNZedH9UvVbi8Gjwl/4ph/SzuzdMl2maQSOZBHYkIvRrmDnTCn/PPsD5ix9l0h2+KXf2 O0lexWNQkCJpeopgNm9JE0fx4r8NjXkfTAbIIgxvQMZZF/H7EYK/76V49AcBE1kC4LBB cF61OJrZBv7p+uXDMIh8wxqYYhYzBlC8FiCZTAG4uGl4ehWCd4g7g7fWV5I9msFhIG3s 65AHWL1ItiVp9jTs7GT4MphNlvxuSSKBJXIcik84+tD9Jpr+0wlqy2ZdoV4iq9jowaMP IXFQ== X-Gm-Message-State: AOJu0Yx6x8wGIK3er+c6KDHxD9T9Tvg/v4liEaSs9zP0e2bItdgDtMqK gV6KPH3tdi14fPPDaGnjp6DjPvXEHR8CFAl7LqhrFDGdrj3izP7nsBqlkq1DlslzDFr4DLE22CO ZITaJmjWXNFatf9/g6bbNAcVKriQ7o5eLVify/wc0q4p0JwTLHbixFKzYs/85rKDnytsfX31W13 kvlLp752BdMWS1xjVs3wxB4gO/xA2l6v3GGQ== X-Received: by 2002:a0d:eb81:0:b0:618:824c:940d with SMTP id u123-20020a0deb81000000b00618824c940dmr92668ywe.25.1712887059054; Thu, 11 Apr 2024 18:57:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGbLE3WX4j94gD3Yve1uAwYBdzBfm7UCOek/QWERQrQ+AOTgE20UsAeKjk/iFOcstPBAKm3lA== X-Received: by 2002:a0d:eb81:0:b0:618:824c:940d with SMTP id u123-20020a0deb81000000b00618824c940dmr92658ywe.25.1712887058716; Thu, 11 Apr 2024 18:57:38 -0700 (PDT) Received: from fedora38.localdomain (172-073-180-250.res.spectrum.com. [172.73.180.250]) by smtp.gmail.com with ESMTPSA id y71-20020a0dd64a000000b00617c80f06cesm602877ywd.90.2024.04.11.18.57.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 18:57:37 -0700 (PDT) From: Ihar Hrachyshka To: dev@openvswitch.org Date: Fri, 12 Apr 2024 01:57:25 +0000 Message-ID: <20240412015727.4152034-5-ihrachys@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240412015727.4152034-1-ihrachys@redhat.com> References: <20240412015727.4152034-1-ihrachys@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn v6 4/6] northd: Delete pb if tunnel is not allocated. 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: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" This allows callers to avoid cleanup of the record in case the function fails. Signed-off-by: Ihar Hrachyshka --- northd/northd.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/northd/northd.c b/northd/northd.c index 4cea669cf..6a8ace52f 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -4322,6 +4322,9 @@ ls_port_init(struct ovn_port *op, struct ovsdb_idl_txn *ovnsb_txn, } /* Assign new tunnel ids where needed. */ if (!ovn_port_allocate_key(sbrec_chassis_table, op)) { + if (!sb) { + sbrec_port_binding_delete(op->sb); + } return false; } ovn_port_update_sbrec(ovnsb_txn, sbrec_chassis_by_name, @@ -4345,9 +4348,6 @@ ls_port_create(struct ovsdb_idl_txn *ovnsb_txn, struct hmap *ls_ports, if (!ls_port_init(op, ovnsb_txn, od, sb, sbrec_mirror_table, sbrec_chassis_table, sbrec_chassis_by_name, sbrec_chassis_by_hostname)) { - if (op->sb) { - sbrec_port_binding_delete(op->sb); - } ovn_port_destroy(ls_ports, op); return NULL; } @@ -4551,8 +4551,8 @@ ls_handle_lsp_changes(struct ovsdb_idl_txn *ovnsb_idl_txn, ni->sbrec_chassis_table, ni->sbrec_chassis_by_name, ni->sbrec_chassis_by_hostname)) { - if (op->sb) { - sbrec_port_binding_delete(op->sb); + if (sb) { + sbrec_port_binding_delete(sb); } ovn_port_destroy(&nd->ls_ports, op); goto fail;