Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsa@cumulusnetworks.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH net-next 10/11] net: Add warning if any lower device is still in adjacency list
Date: Mon, 17 Oct 2016 19:15:52 -0700	[thread overview]
Message-ID: <1476756953-30923-11-git-send-email-dsa@cumulusnetworks.com> (raw)
In-Reply-To: <1476756953-30923-1-git-send-email-dsa@cumulusnetworks.com>

Lower list should be empty just like upper.

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
---
 net/core/dev.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/net/core/dev.c b/net/core/dev.c
index a9fe14908b44..c6bbf310d407 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5219,6 +5219,20 @@ struct net_device *netdev_master_upper_dev_get(struct net_device *dev)
 }
 EXPORT_SYMBOL(netdev_master_upper_dev_get);
 
+/**
+ * netdev_has_any_lower_dev - Check if device is linked to some device
+ * @dev: device
+ *
+ * Find out if a device is linked to a lower device and return true in case
+ * it is. The caller must hold the RTNL lock.
+ */
+static bool netdev_has_any_lower_dev(struct net_device *dev)
+{
+	ASSERT_RTNL();
+
+	return !list_empty(&dev->adj_list.lower);
+}
+
 void *netdev_adjacent_get_private(struct list_head *adj_list)
 {
 	struct netdev_adjacent *adj;
@@ -6616,6 +6630,7 @@ static void rollback_registered_many(struct list_head *head)
 
 		/* Notifier chain MUST detach us all upper devices. */
 		WARN_ON(netdev_has_any_upper_dev(dev));
+		WARN_ON(netdev_has_any_lower_dev(dev));
 
 		/* Remove entries from kobject tree */
 		netdev_unregister_kobject(dev);
-- 
2.1.4


  parent reply	other threads:[~2016-10-18  2:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-18  2:15 [Intel-wired-lan] [PATCH v3 net-next 00/11] net: Fix netdev adjacency tracking David Ahern
2016-10-18  2:15 ` [Intel-wired-lan] [PATCH net-next 01/11] net: Remove refnr arg when inserting link adjacencies David Ahern
2016-10-18  2:15 ` [Intel-wired-lan] [PATCH net-next 02/11] net: Introduce new api for walking upper and lower devices David Ahern
2016-10-18  2:15 ` [Intel-wired-lan] [PATCH net-next 03/11] net: bonding: Flip to the new dev walk API David Ahern
2016-10-18  2:15 ` [Intel-wired-lan] [PATCH net-next 04/11] IB/core: " David Ahern
2016-10-18  2:15 ` [Intel-wired-lan] [PATCH net-next 05/11] IB/ipoib: Flip to " David Ahern
2016-10-18  2:15 ` [Intel-wired-lan] [PATCH net-next 06/11] ixgbe: Flip to the " David Ahern
2016-10-18  2:15 ` [Intel-wired-lan] [PATCH net-next 07/11] mlxsw: " David Ahern
2016-10-18  2:15 ` [Intel-wired-lan] [PATCH net-next 08/11] rocker: " David Ahern
2016-10-18  2:15 ` [Intel-wired-lan] [PATCH net-next 09/11] net: Remove all_adj_list and its references David Ahern
2016-10-18  2:15 ` David Ahern [this message]
2016-10-18  2:15 ` [Intel-wired-lan] [PATCH net-next 11/11] net: dev: Improve debug statements for adjacency tracking David Ahern
2016-10-18 15:46 ` [Intel-wired-lan] [PATCH v3 net-next 00/11] net: Fix netdev " David Miller
2016-10-18 15:58   ` David Ahern
  -- strict thread matches above, loose matches on Subject: below --
2016-10-15  1:28 [Intel-wired-lan] [PATCH v2 " David Ahern
2016-10-15  1:28 ` [Intel-wired-lan] [PATCH net-next 10/11] net: Add warning if any lower device is still in adjacency list David Ahern
2016-10-12 20:51 [Intel-wired-lan] [PATCH net-next 00/11] net: Fix netdev adjacency tracking David Ahern
2016-10-12 20:51 ` [Intel-wired-lan] [PATCH net-next 10/11] net: Add warning if any lower device is still in adjacency list David Ahern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1476756953-30923-11-git-send-email-dsa@cumulusnetworks.com \
    --to=dsa@cumulusnetworks.com \
    --cc=intel-wired-lan@osuosl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox