ipv6: simplify code structure in addrconf.c/manage_tempaddrs
Subsystems (3)
PATCH 1/1 ipv6: simplify code structure in addrconf.c/manage_tempaddrs
read_unlock_bh can be moved out of the if clause
--- net/ipv6/addrconf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
net/ipv6/addrconf.c +1 -3
@@ -2122,6 +2122,7 @@ static void manage_tempaddrs(struct inet6_dev *idev,if (!(flags&IFA_F_TENTATIVE ))ipv6_ifa_notify (0 , ift); } +read_unlock_bh (&idev->lock);if ((create ||list_empty (&idev->tempaddr_list)) && idev->cnf.use_tempaddr >0 ) {
@@ -2130,10 +2131,7 @@ static void manage_tempaddrs(struct inet6_dev *idev,* Also create a temporary address if it's enabled but * no temporary address currently exists. */ -read_unlock_bh (&idev->lock);ipv6_create_tempaddr (ifp,NULL ); - }else { -read_unlock_bh (&idev->lock); } }
Signature · 1 line
1.9.1.315.g3f09db0.dirty
Quoted 20 lines · Heiner Kallweit
read_unlock_bhcan be moved out of the if clauseSigned-off-by Heiner Kallweit <[email protected]>--- net/ipv6/addrconf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)net/ipv6/addrconf.c +1
-0@@ -2122,6 +2122,7 @@ static void manage_tempaddrs(struct inet6_dev *idev,if (!(flags&IFA_F_TENTATIVE ))ipv6_ifa_notify (0 , ift); } +read_unlock_bh (&idev->lock);if ((create ||list_empty (&idev->tempaddr_list)) && idev->cnf.use_tempaddr >0 ) {
net/ipv6/addrconf.c static void manage_tempaddrs(struct inet6_dev *idev, · line 2136
Quoted 7 lines
net/ipv6/addrconf.c +0
-3@@ -2130,10 +2131,7 @@ static void manage_tempaddrs(struct inet6_dev *idev,* Also create a temporary address if it's enabled but * no temporary address currently exists. */ -read_unlock_bh (&idev->lock);ipv6_create_tempaddr (ifp,NULL ); - }else { -read_unlock_bh (&idev->lock);
Doesn't the lock also protect the list_empty? I remember there is a list_empty_careful to check concurrently if empty during possible modification. I actually would leave it as is.
Thanks,
Hannes
Am 31.03.2014 21:21, schrieb Hannes Frederic Sowa:
Quoted 32 lines · Heiner Kallweit
Quoted 20 lines
read_unlock_bhcan be moved out of the if clauseSigned-off-by Heiner Kallweit <[email protected]>--- net/ipv6/addrconf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)net/ipv6/addrconf.c +1
-0@@ -2122,6 +2122,7 @@ static void manage_tempaddrs(struct inet6_dev *idev,if (!(flags&IFA_F_TENTATIVE ))ipv6_ifa_notify (0 , ift); } +read_unlock_bh (&idev->lock);if ((create ||list_empty (&idev->tempaddr_list)) && idev->cnf.use_tempaddr >0 ) {net/ipv6/addrconf.c static void manage_tempaddrs(struct inet6_dev *idev, · line 2136
Quoted 7 lines
net/ipv6/addrconf.c +0
-3@@ -2130,10 +2131,7 @@ static void manage_tempaddrs(struct inet6_dev *idev,* Also create a temporary address if it's enabled but * no temporary address currently exists. */ -read_unlock_bh (&idev->lock);ipv6_create_tempaddr (ifp,NULL ); - }else { -read_unlock_bh (&idev->lock);Doesn't the lock also protect the
list_empty? I remember there is alist_empty_carefulto check concurrently if empty during possible modification. I actually would leave it as is.
Quoted 4 lines
Thanks,
Hannes
You're right, I missed this. I was a little to fast, sorry.