為了監控上線的新核心,我們把google的netoopsbackport到了自己的核心,生產上如有kernel panic,會將panic的棧資訊發送到Log Service器,方便調試和修複。
前天,洪川同學報告說以前線上的netoops都是把bond的slave網口作為發訊息的dev,新上線2.6.32-220核心後,啟動netoops失敗,系統報:
”eth0 is a slave device, aborting."
找了一下從 2.6.32-131 到 2.6.32-220 的redhat的變動,發現了王聰同學的這個patch:
commit 0c1ad04aecb975f2a2014e1bc5a2fa23923ecbd9
Author: WANG Cong www.2cto.com
Date: Thu Jun 9 00:28:13 2011 -0700
netpoll: prevent netpoll setup on slave devices
In commit 8d8fc29d02a33e4bd5f4fa47823c1fd386346093
(netpoll: disable netpoll when enslave a device), we automatically
disable netpoll when the underlying device is being enslaved,
we also need to prevent people from setuping netpoll on
devices that are already enslaved.
Signed-off-by: WANG Cong <www.2cto.com>
Signed-off-by: David S. Miller <www.2cto.com>
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 2d7d6d4..42ea4b0 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -792,6 +792,12 @@ int netpoll_setup(struct netpoll *np)
return -ENODEV;
}
+ if (ndev->master) {
+ printk(KERN_ERR "%s: %s is a slave device, aborting.\n",
+ np->name, np->dev_name);
+ return -EBUSY;
+ }
+
if (!netif_running(ndev)) {
unsigned long atmost, atleast;
從此,netpoll就無法使用slave裝置了(netoops用的就是netpoll),不過我奇怪為什麼以前可以現在又不行了,所以發郵件問了王聰同學為何現在不能使用slave裝置,回答是:
“因為slave裝置沒有IP地址,www.2cto.com”
而且王同學在redhat搞netconsole也遇到了同樣的問題,只能改用master網口。
我們的netoops也只能遵循同樣的規則,統一改用 bond0做dev。