Netdev List
 help / color / mirror / Atom feed
* [PATCH][net-next] ipv6: replace write lock with read lock in addrconf_permanent_addr
@ 2016-03-14  9:35 roy.qing.li
  2016-03-14 16:25 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: roy.qing.li @ 2016-03-14  9:35 UTC (permalink / raw)
  To: netdev

From: Li RongQing <roy.qing.li@gmail.com>

nothing of idev is changed, so read lock is enough

Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
---
 net/ipv6/addrconf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 8c0dab2..d3f0d87 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3228,21 +3228,21 @@ static void addrconf_permanent_addr(struct net_device *dev)
 	if (!idev)
 		return;
 
-	write_lock_bh(&idev->lock);
+	read_lock_bh(&idev->lock);
 
 	list_for_each_entry_safe(ifp, tmp, &idev->addr_list, if_list) {
 		if ((ifp->flags & IFA_F_PERMANENT) &&
 		    fixup_permanent_addr(idev, ifp) < 0) {
-			write_unlock_bh(&idev->lock);
+			read_unlock_bh(&idev->lock);
 			ipv6_del_addr(ifp);
-			write_lock_bh(&idev->lock);
+			read_lock_bh(&idev->lock);
 
 			net_info_ratelimited("%s: Failed to add prefix route for address %pI6c; dropping\n",
 					     idev->dev->name, &ifp->addr);
 		}
 	}
 
-	write_unlock_bh(&idev->lock);
+	read_unlock_bh(&idev->lock);
 }
 
 static int addrconf_notify(struct notifier_block *this, unsigned long event,
-- 
2.1.4

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

end of thread, other threads:[~2016-03-15  0:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-14  9:35 [PATCH][net-next] ipv6: replace write lock with read lock in addrconf_permanent_addr roy.qing.li
2016-03-14 16:25 ` David Miller
2016-03-15  0:36   ` Li RongQing

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox