From patchwork Thu Dec 13 14:24:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Flavio Leitner X-Patchwork-Id: 1012881 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43Fwxk05XTz9s1c for ; Fri, 14 Dec 2018 01:27:38 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 537AA10D8; Thu, 13 Dec 2018 14:25:21 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 96B6E10D8 for ; Thu, 13 Dec 2018 14:25:20 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-qt1-f193.google.com (mail-qt1-f193.google.com [209.85.160.193]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 2A81B82D for ; Thu, 13 Dec 2018 14:25:20 +0000 (UTC) Received: by mail-qt1-f193.google.com with SMTP id l11so2324280qtp.0 for ; Thu, 13 Dec 2018 06:25:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MtUPTmfPeVHVNw1IIN9skwhMJl7h2SI/cXP4dmP0XD4=; b=N8BRTaQfePkaVtqT2mVj1/uMimg1CVIBVhDBn8XHRs8cUo5KiAoJBqxKx2tVPSnXrL cIV5mvShjDe6c/FIHWzExR2pptfAVjEtRM4ZgeOFQju8LR4ouIo1W52e+1wOXobeMX2S JeMt1IUbKYRHkGcCY5w9I1uPaaCXDRE87Cx1zxp8evXJ0rT79BAqoozm+ZwHsTRCUNAB 3vOzdf+F4uo/xFUow6LUXXInhjpyjsN59mAZyHmswQYmGeAd4P/5/CSvRZlTefY/mByZ 5QT2KrlnKkIC3Mtow9u+c7W94tLzhEYZZjPAl5bbXLjZ67M6cXqpQZ6D6pw8gPZPxP7B M4LQ== X-Gm-Message-State: AA+aEWagEofTTy0pympVDtZkUuC4KS2xCy8RJIWfd3Do8v3azWKy5jFg /xO0jk4Ev6gIjYrY9PeLO/xb7NQnOFs= X-Google-Smtp-Source: AFSGD/WUYfOw0prvTgu4+nYeeg0E8Otp5UrJz3HE/v5+sTBUXvPgNsLgG42J3q9oyAfq8qzKb78e1g== X-Received: by 2002:ad4:5004:: with SMTP id s4mr23291983qvo.109.1544711119041; Thu, 13 Dec 2018 06:25:19 -0800 (PST) Received: from localhost ([177.183.214.253]) by smtp.gmail.com with ESMTPSA id q184sm964115qkb.23.2018.12.13.06.25.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Dec 2018 06:25:18 -0800 (PST) From: Flavio Leitner To: dev@openvswitch.org Date: Thu, 13 Dec 2018 12:24:46 -0200 Message-Id: <20181213142448.8504-2-fbl@redhat.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181213142448.8504-1-fbl@redhat.com> References: <20181213142448.8504-1-fbl@redhat.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Guru Shetty , Flavio Leitner Subject: [ovs-dev] [PATCH 1/3] Revert "dpif-netlink: Don't destroy and recreate port if it exists" X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org This reverts commit a38dccb3ee80a1d0b8973191c9e94f045441f8cc. The original commit 7521e0cf9e88 ("ofproto-dpif: Let the dpif report when a port is a duplicate.") relies on the kernel to check if the port exists or not. However, the current kernel code doesn't handle when the port is moved to another network namespace. Signed-off-by: Flavio Leitner --- lib/dpif-netlink.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c index 03470603f..dfa9d9199 100644 --- a/lib/dpif-netlink.c +++ b/lib/dpif-netlink.c @@ -900,7 +900,7 @@ dpif_netlink_rtnl_port_create_and_add(struct dpif_netlink *dpif, name = netdev_vport_get_dpif_port(netdev, namebuf, sizeof namebuf); error = dpif_netlink_port_add__(dpif, name, OVS_VPORT_TYPE_NETDEV, NULL, port_nop); - if (error && error != EEXIST) { + if (error) { dpif_netlink_rtnl_port_destroy(name, netdev_get_type(netdev)); } return error; @@ -917,7 +917,7 @@ dpif_netlink_port_add(struct dpif *dpif_, struct netdev *netdev, if (!ovs_tunnels_out_of_tree) { error = dpif_netlink_rtnl_port_create_and_add(dpif, netdev, port_nop); } - if (error && error != EEXIST) { + if (error) { error = dpif_netlink_port_add_compat(dpif, netdev, port_nop); } fat_rwlock_unlock(&dpif->upcall_lock); From patchwork Thu Dec 13 14:24:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Flavio Leitner X-Patchwork-Id: 1012879 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43FwxF5dfXz9s4s for ; Fri, 14 Dec 2018 01:27:13 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id DEF5A10F7; Thu, 13 Dec 2018 14:25:24 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 1A4EB10F1 for ; Thu, 13 Dec 2018 14:25:24 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-qt1-f194.google.com (mail-qt1-f194.google.com [209.85.160.194]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id B47DD764 for ; Thu, 13 Dec 2018 14:25:23 +0000 (UTC) Received: by mail-qt1-f194.google.com with SMTP id z16so2293708qtq.4 for ; Thu, 13 Dec 2018 06:25:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hgL/lZ2u8f6l4iyyXKcZMq+C04A1xRGWHRLEGr8Hl2w=; b=DXKscxGnQ94P87OvYvnfOistDUfzQQpox/wLqaRF8vbv/wjNBr6Zzuw+X0HxE/+gYX bOpFeZx8IhZd163l7jdyk/A3M6TLlrW6wE9L/XESWhG9eaVxwPhsDtNN+BDUEfK3AbpZ 9RmsvjeIHGrHVBPsM+DqlYlEce56vNNmtCQJN0YjEWRSi47D2W8/3DW8uwoMHtYhR2/Y 8gYhCCine2TgdBgIkbj64+Kdl6iOJp4gU+DiNk+iYtJACE7h3ToZdppnG4SSIllgMPEq e8djfZlt5PIRUupQQzxDLIO7tA79EMJKkKlmjGmIy+QvTI7dt1K9/kADcRsUvuPdr0DL LKfQ== X-Gm-Message-State: AA+aEWZFJ+O8CRJg2L6Y1A8o8FJeo1ZsC0QpLSNl2kXHxlb+2ksZzxOx TkML/zoUv6UvC4KkAZsjPxtC1HnRJTI= X-Google-Smtp-Source: AFSGD/Wcb7KNWZyX7gxV0BmzAi/YQpRALkPS0BH6Jlg2f8d66O6rdniW8Hq4kXaOLIPKwipuosui4Q== X-Received: by 2002:ac8:6949:: with SMTP id n9mr23965558qtr.308.1544711122677; Thu, 13 Dec 2018 06:25:22 -0800 (PST) Received: from localhost ([177.183.214.253]) by smtp.gmail.com with ESMTPSA id r1sm1162369qte.28.2018.12.13.06.25.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Dec 2018 06:25:21 -0800 (PST) From: Flavio Leitner To: dev@openvswitch.org Date: Thu, 13 Dec 2018 12:24:47 -0200 Message-Id: <20181213142448.8504-3-fbl@redhat.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181213142448.8504-1-fbl@redhat.com> References: <20181213142448.8504-1-fbl@redhat.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Guru Shetty , Flavio Leitner Subject: [ovs-dev] [PATCH 2/3] Revert "ofproto-dpif: Check for EBUSY as well" X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org This reverts commit c65259a9b6e5380ac963944b69949ceb71ae623a. The original commit 7521e0cf9e88 ("ofproto-dpif: Let the dpif report when a port is a duplicate.") relies on the kernel to check if the port exists or not. However, the current kernel code doesn't handle when the port is moved to another network namespace. Signed-off-by: Flavio Leitner --- ofproto/ofproto-dpif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 2dc5778e1..f40f157ca 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -3665,7 +3665,7 @@ port_add(struct ofproto *ofproto_, struct netdev *netdev) odp_port_t port_no = ODPP_NONE; int error = dpif_port_add(ofproto->backer->dpif, netdev, &port_no); - if (error != EEXIST && error != EBUSY) { + if (error != EEXIST) { if (error) { return error; } From patchwork Thu Dec 13 14:24:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Flavio Leitner X-Patchwork-Id: 1012878 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43FwxC5Sbtz9s5c for ; Fri, 14 Dec 2018 01:27:11 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 70FFE110A; Thu, 13 Dec 2018 14:25:28 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id D82D910F5 for ; Thu, 13 Dec 2018 14:25:27 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-qt1-f193.google.com (mail-qt1-f193.google.com [209.85.160.193]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 60D85764 for ; Thu, 13 Dec 2018 14:25:27 +0000 (UTC) Received: by mail-qt1-f193.google.com with SMTP id i7so2256192qtj.10 for ; Thu, 13 Dec 2018 06:25:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0r+ewqH0joGqg/bgXIKmc5/7Y8YNmrHxXmEoE2jXW+Y=; b=tHj68zDeaV04v8ALs8AO+cE5Pt2CMjoAs8S+TVdOLGiLgkKl3nexakDkAifObwEIdC HWwto9VgqlGym6PqvkzCm6YYOSBJ4l1stUmPQLB1ZH/uVM82HzTvu4QD09YpuGn7kfdp LgwjqEN5LUTUCmtgagTGNwxb9xkW+xVrvTwtAIPZ6Yr9PVkQOFQXqZCMjTBrqByDjyX8 Zlsww/G6WVPxmath9GSWfWE0FbIK2fpk7cyRAUrj62HOrmZabgKVXx1dcWuZAk8OPIUh uKjtO/qQts3INikpMhfZihorWK4PMzRgEiXaMgPaVpQ+6a7k6Jv//mgxixGLYHtjzmo4 L1Bg== X-Gm-Message-State: AA+aEWYFBK79Wz/QGU37zW9rG9WbPmollBOqWjSLIFw/GdaX8nzO1RG6 0lphCDriNj7ur7ZqvtfLOQV1j5lk000= X-Google-Smtp-Source: AFSGD/WLw+Ss4+hTO5cg09AjliCCpESk4ICHS5HLSl3hqMUHjJASagMaQmp5kQavxHllVjqkUL6A5Q== X-Received: by 2002:aed:2391:: with SMTP id j17mr23686776qtc.205.1544711126286; Thu, 13 Dec 2018 06:25:26 -0800 (PST) Received: from localhost ([177.183.214.253]) by smtp.gmail.com with ESMTPSA id q72sm1198229qki.24.2018.12.13.06.25.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Dec 2018 06:25:25 -0800 (PST) From: Flavio Leitner To: dev@openvswitch.org Date: Thu, 13 Dec 2018 12:24:48 -0200 Message-Id: <20181213142448.8504-4-fbl@redhat.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181213142448.8504-1-fbl@redhat.com> References: <20181213142448.8504-1-fbl@redhat.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Guru Shetty , Flavio Leitner Subject: [ovs-dev] [PATCH 3/3] Revert "ofproto-dpif: Let the dpif report when a port is a duplicate." X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org This reverts commit 7521e0cf9e88a62f2feff4e7253654557f94877e. This patch introduced a regression in OSP environments using internal ports in other netns. Their networking configuration is lost when the service is restarted because the ports are recreated now. Before the patch it checked using netlink if the port with a specific "name" was already there. The check is a lookup in all ports attached to the DP regardless of the port's netns. After the patch it relies on the kernel to identify that situation. Unfortunately the only protection there is register_netdevice() which fails only if the port with that name exists in the current netns. If the port is in another netns, it will get a new dp_port and because of that userspace will delete the old port. At this point the original port is gone from the other netns and there a fresh port in the current netns. Signed-off-by: Flavio Leitner --- lib/dpif.c | 9 ++------- ofproto/ofproto-dpif.c | 7 ++++--- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/dpif.c b/lib/dpif.c index e35f11147..457c9bfb9 100644 --- a/lib/dpif.c +++ b/lib/dpif.c @@ -592,13 +592,8 @@ dpif_port_add(struct dpif *dpif, struct netdev *netdev, odp_port_t *port_nop) netdev_ports_insert(netdev, dpif->dpif_class, &dpif_port); } } else { - if (error != EEXIST) { - VLOG_WARN_RL(&error_rl, "%s: failed to add %s as port: %s", - dpif_name(dpif), netdev_name, ovs_strerror(error)); - } else { - /* It's fairly common for upper layers to try to add a duplicate - * port, and they know how to handle it properly. */ - } + VLOG_WARN_RL(&error_rl, "%s: failed to add %s as port: %s", + dpif_name(dpif), netdev_name, ovs_strerror(error)); port_no = ODPP_NONE; } if (port_nop) { diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index f40f157ca..252e8add6 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -3662,10 +3662,11 @@ port_add(struct ofproto *ofproto_, struct netdev *netdev) } dp_port_name = netdev_vport_get_dpif_port(netdev, namebuf, sizeof namebuf); + if (!dpif_port_exists(ofproto->backer->dpif, dp_port_name)) { + odp_port_t port_no = ODPP_NONE; + int error; - odp_port_t port_no = ODPP_NONE; - int error = dpif_port_add(ofproto->backer->dpif, netdev, &port_no); - if (error != EEXIST) { + error = dpif_port_add(ofproto->backer->dpif, netdev, &port_no); if (error) { return error; }