All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/4] bonding: Fix some minor issues for bonding.
@ 2014-02-21  8:08 Ding Tianhong
  2014-02-21  8:08 ` [PATCH net-next 1/4] bonding: netpoll: remove unwanted slave_dev_support_netpoll() Ding Tianhong
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Ding Tianhong @ 2014-02-21  8:08 UTC (permalink / raw)
  To: fubar, vfalico, andy; +Cc: davem, netdev

Ding Tianhong (4):
  bonding: netpoll: remove unwanted slave_dev_support_netpoll()
  bonding: use rcu_dereference() to access curr_active_slave
  bonding: remove no longer needed lock for bond_xxx_info_query()
  bonding: don't ensalve loopback device

 drivers/net/bonding/bond_main.c   | 19 ++++++-------------
 drivers/net/bonding/bond_procfs.c |  4 +---
 2 files changed, 7 insertions(+), 16 deletions(-)

-- 
1.8.0

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH net-next 1/4] bonding: netpoll: remove unwanted slave_dev_support_netpoll()
  2014-02-21  8:08 [PATCH net-next 0/4] bonding: Fix some minor issues for bonding Ding Tianhong
@ 2014-02-21  8:08 ` Ding Tianhong
  2014-02-21  8:08 ` [PATCH net-next 2/4] bonding: use rcu_dereference() to access curr_active_slave Ding Tianhong
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Ding Tianhong @ 2014-02-21  8:08 UTC (permalink / raw)
  To: fubar, vfalico, andy; +Cc: davem, netdev

The __netpoll_setup() will check the slave's flag and ndo_poll_controller just
like the slave_dev_support_netpoll() does, and slave_dev_support_netpoll() was
not used by any place, so remove it.

Cc: Jay Vosburgh <fubar@us.ibm.com>
Cc: Veaceslav Falico <vfalico@redhat.com>
Cc: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
---
 drivers/net/bonding/bond_main.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 71edf03..affe0c4 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -942,14 +942,6 @@ static inline void slave_disable_netpoll(struct slave *slave)
 	slave->np = NULL;
 	__netpoll_free_async(np);
 }
-static inline bool slave_dev_support_netpoll(struct net_device *slave_dev)
-{
-	if (slave_dev->priv_flags & IFF_DISABLE_NETPOLL)
-		return false;
-	if (!slave_dev->netdev_ops->ndo_poll_controller)
-		return false;
-	return true;
-}
 
 static void bond_poll_controller(struct net_device *bond_dev)
 {
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-next 2/4] bonding: use rcu_dereference() to access curr_active_slave
  2014-02-21  8:08 [PATCH net-next 0/4] bonding: Fix some minor issues for bonding Ding Tianhong
  2014-02-21  8:08 ` [PATCH net-next 1/4] bonding: netpoll: remove unwanted slave_dev_support_netpoll() Ding Tianhong
@ 2014-02-21  8:08 ` Ding Tianhong
  2014-02-21  8:08 ` [PATCH net-next 3/4] bonding: remove no longer needed lock for bond_xxx_info_query() Ding Tianhong
  2014-02-21  8:08 ` [PATCH net-next 4/4] bonding: don't ensalve loopback device Ding Tianhong
  3 siblings, 0 replies; 6+ messages in thread
From: Ding Tianhong @ 2014-02-21  8:08 UTC (permalink / raw)
  To: fubar, vfalico, andy; +Cc: davem, netdev

The bond_info_show_master already in RCU read-side critical section,
and the we access curr_active_slave without the curr_slave_lock, we
could not sure whether the curr_active_slave will be changed during
the processing, so use RCU to protected the pointer.

Cc: Jay Vosburgh <fubar@us.ibm.com>
Cc: Veaceslav Falico <vfalico@redhat.com>
Cc: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
---
 drivers/net/bonding/bond_procfs.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c
index 434df73..588cf39 100644
--- a/drivers/net/bonding/bond_procfs.c
+++ b/drivers/net/bonding/bond_procfs.c
@@ -69,9 +69,7 @@ static void bond_info_show_master(struct seq_file *seq)
 	struct slave *curr;
 	int i;
 
-	read_lock(&bond->curr_slave_lock);
-	curr = bond->curr_active_slave;
-	read_unlock(&bond->curr_slave_lock);
+	curr = rcu_dereference(bond->curr_active_slave);
 
 	seq_printf(seq, "Bonding Mode: %s",
 		   bond_mode_name(bond->params.mode));
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-next 3/4] bonding: remove no longer needed lock for bond_xxx_info_query()
  2014-02-21  8:08 [PATCH net-next 0/4] bonding: Fix some minor issues for bonding Ding Tianhong
  2014-02-21  8:08 ` [PATCH net-next 1/4] bonding: netpoll: remove unwanted slave_dev_support_netpoll() Ding Tianhong
  2014-02-21  8:08 ` [PATCH net-next 2/4] bonding: use rcu_dereference() to access curr_active_slave Ding Tianhong
@ 2014-02-21  8:08 ` Ding Tianhong
  2014-02-21  8:08 ` [PATCH net-next 4/4] bonding: don't ensalve loopback device Ding Tianhong
  3 siblings, 0 replies; 6+ messages in thread
From: Ding Tianhong @ 2014-02-21  8:08 UTC (permalink / raw)
  To: fubar, vfalico, andy; +Cc: davem, netdev

The bond_xxx_info_query() was already in RTNL, so no need to use
bond lock to protect the bond slave list, so remove it.

Cc: Jay Vosburgh <fubar@us.ibm.com>
Cc: Veaceslav Falico <vfalico@redhat.com>
Cc: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
---
 drivers/net/bonding/bond_main.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index affe0c4..4fa8ea7 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1816,9 +1816,7 @@ static int bond_info_query(struct net_device *bond_dev, struct ifbond *info)
 	info->bond_mode = bond->params.mode;
 	info->miimon = bond->params.miimon;
 
-	read_lock(&bond->lock);
 	info->num_slaves = bond->slave_cnt;
-	read_unlock(&bond->lock);
 
 	return 0;
 }
@@ -1830,7 +1828,6 @@ static int bond_slave_info_query(struct net_device *bond_dev, struct ifslave *in
 	int i = 0, res = -ENODEV;
 	struct slave *slave;
 
-	read_lock(&bond->lock);
 	bond_for_each_slave(bond, slave, iter) {
 		if (i++ == (int)info->slave_id) {
 			res = 0;
@@ -1841,7 +1838,6 @@ static int bond_slave_info_query(struct net_device *bond_dev, struct ifslave *in
 			break;
 		}
 	}
-	read_unlock(&bond->lock);
 
 	return res;
 }
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-next 4/4] bonding: don't ensalve loopback device
  2014-02-21  8:08 [PATCH net-next 0/4] bonding: Fix some minor issues for bonding Ding Tianhong
                   ` (2 preceding siblings ...)
  2014-02-21  8:08 ` [PATCH net-next 3/4] bonding: remove no longer needed lock for bond_xxx_info_query() Ding Tianhong
@ 2014-02-21  8:08 ` Ding Tianhong
  2014-02-24 23:28   ` David Miller
  3 siblings, 1 reply; 6+ messages in thread
From: Ding Tianhong @ 2014-02-21  8:08 UTC (permalink / raw)
  To: fubar, vfalico, andy; +Cc: davem, netdev

I could not see any effect that enslave a loopback device, so don't
enslave such device for bonding.

Use pr_err to instead of pr_debug when return error.

Cc: Jay Vosburgh <fubar@us.ibm.com>
Cc: Veaceslav Falico <vfalico@redhat.com>
Cc: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
---
 drivers/net/bonding/bond_main.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 4fa8ea7..b75c815 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1176,9 +1176,14 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
 			bond_dev->name, slave_dev->name);
 	}
 
+	if (slave_dev->flags & IFF_LOOPBACK) {
+		pr_err("Error: cannot enslave loopback device\n");
+		return -EINVAL;
+	}
+
 	/* already enslaved */
 	if (slave_dev->flags & IFF_SLAVE) {
-		pr_debug("Error: Device was already enslaved\n");
+		pr_err("Error: Device was already enslaved\n");
 		return -EBUSY;
 	}
 
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next 4/4] bonding: don't ensalve loopback device
  2014-02-21  8:08 ` [PATCH net-next 4/4] bonding: don't ensalve loopback device Ding Tianhong
@ 2014-02-24 23:28   ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2014-02-24 23:28 UTC (permalink / raw)
  To: dingtianhong; +Cc: fubar, vfalico, andy, netdev

From: Ding Tianhong <dingtianhong@huawei.com>
Date: Fri, 21 Feb 2014 16:08:55 +0800

> I could not see any effect that enslave a loopback device, so don't
> enslave such device for bonding.
> 
> Use pr_err to instead of pr_debug when return error.
> 
> Cc: Jay Vosburgh <fubar@us.ibm.com>
> Cc: Veaceslav Falico <vfalico@redhat.com>
> Cc: Andy Gospodarek <andy@greyhouse.net>
> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>

I do not agree at all with this patch, you can't just stop providing
functionality because you personally can't figure out a way in which
to use it.

I'll apply the other 3 patches, those are fine.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-02-24 23:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-21  8:08 [PATCH net-next 0/4] bonding: Fix some minor issues for bonding Ding Tianhong
2014-02-21  8:08 ` [PATCH net-next 1/4] bonding: netpoll: remove unwanted slave_dev_support_netpoll() Ding Tianhong
2014-02-21  8:08 ` [PATCH net-next 2/4] bonding: use rcu_dereference() to access curr_active_slave Ding Tianhong
2014-02-21  8:08 ` [PATCH net-next 3/4] bonding: remove no longer needed lock for bond_xxx_info_query() Ding Tianhong
2014-02-21  8:08 ` [PATCH net-next 4/4] bonding: don't ensalve loopback device Ding Tianhong
2014-02-24 23:28   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.