aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netconsole.c
diff options
context:
space:
mode:
authorAmerigo Wang <amwang@redhat.com>2011-05-19 17:39:10 -0400
committerDavid S. Miller <davem@davemloft.net>2011-05-22 21:01:19 -0400
commit8d8fc29d02a33e4bd5f4fa47823c1fd386346093 (patch)
tree822657741aca7297209c28c906f6b8caa43d163b /drivers/net/netconsole.c
parenta37dd3332319260cce81ac91ce25fcc3a31de997 (diff)
netpoll: disable netpoll when enslave a device
V3: rename NETDEV_ENSLAVE to NETDEV_JOIN Currently we do nothing when we enslave a net device which is running netconsole. Neil pointed out that we may get weird results in such case, so let's disable netpoll on the device being enslaved. I think it is too harsh to prevent the device being ensalved if it is running netconsole. By the way, this patch also removes the NETDEV_GOING_DOWN from netconsole netdev notifier, because netpoll will check if the device is running or not and we don't handle NETDEV_PRE_UP neither. This patch is based on net-next-2.6. Signed-off-by: WANG Cong <amwang@redhat.com> Cc: Neil Horman <nhorman@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netconsole.c')
-rw-r--r--drivers/net/netconsole.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index a83e101440fd..4190786de403 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -621,11 +621,10 @@ static int netconsole_netdev_event(struct notifier_block *this,
621 bool stopped = false; 621 bool stopped = false;
622 622
623 if (!(event == NETDEV_CHANGENAME || event == NETDEV_UNREGISTER || 623 if (!(event == NETDEV_CHANGENAME || event == NETDEV_UNREGISTER ||
624 event == NETDEV_BONDING_DESLAVE || event == NETDEV_GOING_DOWN)) 624 event == NETDEV_BONDING_DESLAVE || event == NETDEV_JOIN))
625 goto done; 625 goto done;
626 626
627 spin_lock_irqsave(&target_list_lock, flags); 627 spin_lock_irqsave(&target_list_lock, flags);
628restart:
629 list_for_each_entry(nt, &target_list, list) { 628 list_for_each_entry(nt, &target_list, list) {
630 netconsole_target_get(nt); 629 netconsole_target_get(nt);
631 if (nt->np.dev == dev) { 630 if (nt->np.dev == dev) {
@@ -633,6 +632,8 @@ restart:
633 case NETDEV_CHANGENAME: 632 case NETDEV_CHANGENAME:
634 strlcpy(nt->np.dev_name, dev->name, IFNAMSIZ); 633 strlcpy(nt->np.dev_name, dev->name, IFNAMSIZ);
635 break; 634 break;
635 case NETDEV_BONDING_DESLAVE:
636 case NETDEV_JOIN:
636 case NETDEV_UNREGISTER: 637 case NETDEV_UNREGISTER:
637 /* 638 /*
638 * rtnl_lock already held 639 * rtnl_lock already held
@@ -647,11 +648,7 @@ restart:
647 dev_put(nt->np.dev); 648 dev_put(nt->np.dev);
648 nt->np.dev = NULL; 649 nt->np.dev = NULL;
649 netconsole_target_put(nt); 650 netconsole_target_put(nt);
650 goto restart;
651 } 651 }
652 /* Fall through */
653 case NETDEV_GOING_DOWN:
654 case NETDEV_BONDING_DESLAVE:
655 nt->enabled = 0; 652 nt->enabled = 0;
656 stopped = true; 653 stopped = true;
657 break; 654 break;
@@ -660,10 +657,21 @@ restart:
660 netconsole_target_put(nt); 657 netconsole_target_put(nt);
661 } 658 }
662 spin_unlock_irqrestore(&target_list_lock, flags); 659 spin_unlock_irqrestore(&target_list_lock, flags);
663 if (stopped && (event == NETDEV_UNREGISTER || event == NETDEV_BONDING_DESLAVE)) 660 if (stopped) {
664 printk(KERN_INFO "netconsole: network logging stopped on " 661 printk(KERN_INFO "netconsole: network logging stopped on "
665 "interface %s as it %s\n", dev->name, 662 "interface %s as it ", dev->name);
666 event == NETDEV_UNREGISTER ? "unregistered" : "released slaves"); 663 switch (event) {
664 case NETDEV_UNREGISTER:
665 printk(KERN_CONT "unregistered\n");
666 break;
667 case NETDEV_BONDING_DESLAVE:
668 printk(KERN_CONT "released slaves\n");
669 break;
670 case NETDEV_JOIN:
671 printk(KERN_CONT "is joining a master device\n");
672 break;
673 }
674 }
667 675
668done: 676done:
669 return NOTIFY_DONE; 677 return NOTIFY_DONE;