Received: by 2002:a05:6a10:c7d3:0:0:0:0 with SMTP id h19csp142086pxy; Sat, 14 Aug 2021 02:59:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRLvu63itirGpAtOFoZ9HS9EpJqkEsm6xODxEic0zNWDsA6KK6GKDvcSpQjk7UFT3s9BP6 X-Received: by 2002:aa7:c810:: with SMTP id a16mr8254133edt.195.1628935165281; Sat, 14 Aug 2021 02:59:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628935165; cv=none; d=google.com; s=arc-20160816; b=raSF2HhEJriCnBVO15Gg0ZipsIcdwEJ//uYv/ram0uTHqEanVJHbE1yxJZF8C460mr trMSoNhqViy5EnXePH9nHIdPCdF6CPxLVhyZAVWk+0xsGeH0iT0haBkr0Pn7DzmKQif3 UiDzBY6Bd/qD72h1sv1dIAXLFKnMPFw9GiWQyAK2CEkT+ihEhPjBfwCsGRgb8Nu2QkdL xLWVlo4eYt7ea+0LvqMBvFclVLUwerb5jqWfEoAThI8H2Ol0KgFI6+U0wavywEIyTevb 4zxRWPL8D0bYrW6xrCsA7UrWl1YgJ6sSIpJ9veqadKN8J+dH0bRCcedvDXE1ys5p0/4X vLyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GzQQ5sr1F94OD60u1+YUMxZ6fA9OZHJMn339tB1t3b8=; b=zxJeSezfw/qN2b1XWczNglsZpvi4CBsOJo7qOaiPtLjzvcT0HNFVXjR4kMh75FKect oVxDfNeoc2T9RAo4g/dAjlLo9vtd4XFuwT3IfOZipzb/4Vnw8NUZ7mHxrYa0859dWpio vbTTvFEBGWmzb2YNa3JeqE/QsgSAua8wixKKBPYX0N2CrL46zCPnTyA6E2Cp2tvbmeE7 6umWeuNOHJiobMNW+noh214gm1t+vEAbn9P/u17VAladx5K9lhGeLYzpsfClOx59t9YO LyVaJUj7FAUsZe7JwpRvae6HNWNIZpxpsle0RujNwTkYO3wif1H/qIhtRvtkgEdGAfjh UHgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QBVtqhI2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u19si4704877edo.454.2021.08.14.02.59.02; Sat, 14 Aug 2021 02:59:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QBVtqhI2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237827AbhHNJ6M (ORCPT + 99 others); Sat, 14 Aug 2021 05:58:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:37460 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237773AbhHNJ6J (ORCPT ); Sat, 14 Aug 2021 05:58:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D4F3E60E93; Sat, 14 Aug 2021 09:57:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628935061; bh=sncrE3HsRIhHLQMLLwFadwJDxDl1C41sdTzur3zQFaU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QBVtqhI2q/jSCii8kyllJS90WBbRf7B6c9JxY/T6NqwW+P/ZfgFJiI7Var8hNa363 JDqAuHkJU8XlhS1D+IvMMqfb6cq2xvfa3iY30zqBeo61/UZfn6/rHRvkg4EvAAoALe eALK7fhLIs60h7mh9rQRwoHt1LI2DueNywaPGRWflrSWewwC0Zo0YCuRfmyyVJUddC fcJ/LUx0h1ckr+xgfqUhQfVFwJNwWAJjz1eXazqnTu+EBcJw4V/I8eGfQTd+e6lxlZ m1qjsEGL1AiWYHo2iErWtFAgv9g670GaqC1aOtZ3as8KuiWiqwH0lyrOTBacw6EUfK Wmy/OUvxhsJhQ== From: Leon Romanovsky To: "David S . Miller" , Jakub Kicinski Cc: Leon Romanovsky , Guangbin Huang , Jacob Keller , Jiri Pirko , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Salil Mehta , Shannon Nelson , Yisen Zhuang , Yufeng Mo Subject: [PATCH net-next 1/6] devlink: Simplify devlink_pernet_pre_exit call Date: Sat, 14 Aug 2021 12:57:26 +0300 Message-Id: <98298393caf87126db0fc0e888010ed1cdcaf786.1628933864.git.leonro@nvidia.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Leon Romanovsky The devlink_pernet_pre_exit() will be called if net namespace exits. That routine is relevant for devlink instances that were assigned to that namespaces first. This assignment is possible only with the following command: "devlink reload DEV netns ...", which already checks reload support. Signed-off-by: Leon Romanovsky --- net/core/devlink.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/net/core/devlink.c b/net/core/devlink.c index ee9787314cff..9e74a95b3322 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -11392,16 +11392,16 @@ static void __net_exit devlink_pernet_pre_exit(struct net *net) */ mutex_lock(&devlink_mutex); list_for_each_entry(devlink, &devlink_list, list) { - if (net_eq(devlink_net(devlink), net)) { - if (WARN_ON(!devlink_reload_supported(devlink->ops))) - continue; - err = devlink_reload(devlink, &init_net, - DEVLINK_RELOAD_ACTION_DRIVER_REINIT, - DEVLINK_RELOAD_LIMIT_UNSPEC, - &actions_performed, NULL); - if (err && err != -EOPNOTSUPP) - pr_warn("Failed to reload devlink instance into init_net\n"); - } + if (!net_eq(devlink_net(devlink), net)) + continue; + + WARN_ON(!devlink_reload_supported(devlink->ops)); + err = devlink_reload(devlink, &init_net, + DEVLINK_RELOAD_ACTION_DRIVER_REINIT, + DEVLINK_RELOAD_LIMIT_UNSPEC, + &actions_performed, NULL); + if (err && err != -EOPNOTSUPP) + pr_warn("Failed to reload devlink instance into init_net\n"); } mutex_unlock(&devlink_mutex); } -- 2.31.1