Thread (15 messages) 15 messages, 5 authors, 2013-02-06

Re: [PATCH v3] netpoll: protect napi_poll and poll_controller during dev_[open|close]

From: Francois Romieu <romieu@fr.zoreil.com>
Date: 2013-02-01 21:53:04

Neil Horman [off-list ref] :
[...]
quoted hunk ↗ jump to hunk
diff --git a/net/core/dev.c b/net/core/dev.c
index a87bc74..90b267a 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
[...]
quoted hunk ↗ jump to hunk
@@ -1266,6 +1268,19 @@ static int __dev_open(struct net_device *dev)
 	if (!netif_device_present(dev))
 		return -ENODEV;
 
+	/*
+	 * Block netpoll from trying to do any rx path servicing
+	 * If we don't do this there is a chance ndo_poll_controller
+	 * or ndo_poll may be running while we open the device
+	 */
+	rcu_read_lock();
+	ni = rcu_dereference(dev->npinfo);
+	if (ni && test_and_set_bit(NETPOLL_RX_ACTIVE, &ni->flags)) {
+		rcu_read_unlock();
+		return -EBUSY;
+	}
+	rcu_read_unlock();
+
struct net_device contains no npinfo member when CONFIG_NETPOLL is not set.

-- 
Ueimor
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help