From patchwork Sun Apr 27 06:16:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roopa Prabhu X-Patchwork-Id: 343123 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 20ABD1400D6 for ; Sun, 27 Apr 2014 16:16:53 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752774AbaD0GQc (ORCPT ); Sun, 27 Apr 2014 02:16:32 -0400 Received: from ext3.cumulusnetworks.com ([198.211.106.187]:56696 "EHLO ext3.cumulusnetworks.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752744AbaD0GQb (ORCPT ); Sun, 27 Apr 2014 02:16:31 -0400 Received: from localhost (localhost [127.0.0.1]) by ext3.cumulusnetworks.com (Postfix) with ESMTP id 58B43176255C; Sat, 26 Apr 2014 23:16:30 -0700 (PDT) Received: from ext3.cumulusnetworks.com ([127.0.0.1]) by localhost (ext3.cumulusnetworks.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id xDVGeQbSlot2; Sat, 26 Apr 2014 23:16:29 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by ext3.cumulusnetworks.com (Postfix) with ESMTP id C682A1762566; Sat, 26 Apr 2014 23:16:29 -0700 (PDT) X-Virus-Scanned: amavisd-new at cumulusnetworks.com Received: from ext3.cumulusnetworks.com ([127.0.0.1]) by localhost (ext3.cumulusnetworks.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Iim0WxSrnZjD; Sat, 26 Apr 2014 23:16:29 -0700 (PDT) Received: from Roopas-MacBook-Pro-2.local (c-76-103-138-185.hsd1.ca.comcast.net [76.103.138.185]) by ext3.cumulusnetworks.com (Postfix) with ESMTPSA id 371F5176255C; Sat, 26 Apr 2014 23:16:29 -0700 (PDT) Message-ID: <535CA0BB.1010504@cumulusnetworks.com> Date: Sat, 26 Apr 2014 23:16:27 -0700 From: Roopa Prabhu User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: netdev CC: Jiri Pirko , Thomas Graf , David Miller Subject: Question regarding bond delete notifications Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hello, I am seeing a problem with the order of rtnl link notifications during bond deletes. If i delete a bond without deleting its slaves, kernel sends a RTM_DELLINK during unregister_netdevice (in rollback_registered_many) and then calls bond_uninit (ndo_uninit). bond_uninit inturn cleans up the slaves and generates a few RTM_NEWLINK rtnl notifications for NETDEV_CHANGEADDR and NETDEV_FEAT_CHANGE for the bond device. This is confusing to userspace listening for rtnl LINK Notifications. For example, libnl gets confused with RTM_NEWLINK arriving after RTM_DELLINK. The RTM_NEWLINK makes libnl believe that this is a new bond link. But kernel has already deleted the bond device. It seems like the kernel should generate RTM_DELLINK notification after ndo_uninit. something like below. But am not sure if this change is safe for other netdevices. Is this a known problem ?. Any suggestions ? Thanks, Roopa } --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/core/dev.c b/net/core/dev.c index b1b0c8d..85cb73a 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -5568,33 +5568,33 @@ static void rollback_registered_many(struct list_head *head) list_for_each_entry(dev, head, unreg_list) { /* Shutdown queueing discipline. */ dev_shutdown(dev); /* Notify protocols, that we are about to destroy this device. They should clean all the things. */ call_netdevice_notifiers(NETDEV_UNREGISTER, dev); - if (!dev->rtnl_link_ops || - dev->rtnl_link_state == RTNL_LINK_INITIALIZED) - rtmsg_ifinfo(RTM_DELLINK, dev, ~0U, GFP_KERNEL); - /* * Flush the unicast and multicast chains */ dev_uc_flush(dev); dev_mc_flush(dev); if (dev->netdev_ops->ndo_uninit) dev->netdev_ops->ndo_uninit(dev); + if (!dev->rtnl_link_ops || + dev->rtnl_link_state == RTNL_LINK_INITIALIZED) + rtmsg_ifinfo(RTM_DELLINK, dev, ~0U, GFP_KERNEL); + /* Notifier chain MUST detach us all upper devices. */ WARN_ON(netdev_has_any_upper_dev(dev)); /* Remove entries from kobject tree */ netdev_unregister_kobject(dev); #ifdef CONFIG_XPS /* Remove XPS queueing entries */ netif_reset_xps_queues_gt(dev, 0); #endif