lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 11 Apr 2019 15:06:09 +0800
From:   Litao Jiao <jiaolitao@...secom.com>
To:     davem@...emloft.net
Cc:     petrm@...lanox.com, idosch@...lanox.com, roopa@...ulusnetworks.com,
        sbrivio@...hat.com, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, jiaolitao@...secom.com
Subject: [PATCH] vxlan: using hash_lock to protect one budegt in vxlan_flush

The hash_lock will hold long time in vxlan_flush when stopping the
vxlan device in which there has lots of vxlan fdb entries;it would
affect the bh process in local cpu; and other cpu would wait for
a long time in vxlan_snoop until the hash_lock is released;so
using hash_lock to protect one budegt in vxlan_flush could
reduce the continuous holding time of the lock.

Signed-off-by: Litao Jiao <jiaolitao@...secom.com>
---
 drivers/net/vxlan.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index d76dfed..306703e 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2816,9 +2816,10 @@ static void vxlan_flush(struct vxlan_dev *vxlan, bool do_all)
 {
 	unsigned int h;
 
-	spin_lock_bh(&vxlan->hash_lock);
 	for (h = 0; h < FDB_HASH_SIZE; ++h) {
 		struct hlist_node *p, *n;
+
+		spin_lock_bh(&vxlan->hash_lock);
 		hlist_for_each_safe(p, n, &vxlan->fdb_head[h]) {
 			struct vxlan_fdb *f
 				= container_of(p, struct vxlan_fdb, hlist);
@@ -2828,8 +2829,8 @@ static void vxlan_flush(struct vxlan_dev *vxlan, bool do_all)
 			if (!is_zero_ether_addr(f->eth_addr))
 				vxlan_fdb_destroy(vxlan, f, true, true);
 		}
+		spin_unlock_bh(&vxlan->hash_lock);
 	}
-	spin_unlock_bh(&vxlan->hash_lock);
 }
 
 /* Cleanup timer and forwarding table on shutdown */
-- 
1.9.1



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ