* [PATCH] ipv6: simplify code structure in addrconf.c/manage_tempaddrs
@ 2014-03-31 18:47 Heiner Kallweit
2014-03-31 19:21 ` Hannes Frederic Sowa
0 siblings, 1 reply; 3+ messages in thread
From: Heiner Kallweit @ 2014-03-31 18:47 UTC (permalink / raw)
To: netdev@vger.kernel.org
read_unlock_bh can be moved out of the if clause
Signed-off-by: Heiner Kallweit <heiner.kallweit@web.de>
---
net/ipv6/addrconf.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 6c7fa08..a65812f 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -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);
}
}
--
1.9.1.315.g3f09db0.dirty
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ipv6: simplify code structure in addrconf.c/manage_tempaddrs
2014-03-31 18:47 [PATCH] ipv6: simplify code structure in addrconf.c/manage_tempaddrs Heiner Kallweit
@ 2014-03-31 19:21 ` Hannes Frederic Sowa
2014-03-31 19:27 ` Heiner Kallweit
0 siblings, 1 reply; 3+ messages in thread
From: Hannes Frederic Sowa @ 2014-03-31 19:21 UTC (permalink / raw)
To: Heiner Kallweit; +Cc: netdev@vger.kernel.org
On Mon, Mar 31, 2014 at 08:47:42PM +0200, Heiner Kallweit wrote:
> read_unlock_bh can be moved out of the if clause
>
> Signed-off-by: Heiner Kallweit <heiner.kallweit@web.de>
> ---
> net/ipv6/addrconf.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index 6c7fa08..a65812f 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -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);
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ipv6: simplify code structure in addrconf.c/manage_tempaddrs
2014-03-31 19:21 ` Hannes Frederic Sowa
@ 2014-03-31 19:27 ` Heiner Kallweit
0 siblings, 0 replies; 3+ messages in thread
From: Heiner Kallweit @ 2014-03-31 19:27 UTC (permalink / raw)
To: Hannes Frederic Sowa, netdev@vger.kernel.org
Am 31.03.2014 21:21, schrieb Hannes Frederic Sowa:
> On Mon, Mar 31, 2014 at 08:47:42PM +0200, Heiner Kallweit wrote:
>> read_unlock_bh can be moved out of the if clause
>>
>> Signed-off-by: Heiner Kallweit <heiner.kallweit@web.de>
>> ---
>> net/ipv6/addrconf.c | 4 +---
>> 1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
>> index 6c7fa08..a65812f 100644
>> --- a/net/ipv6/addrconf.c
>> +++ b/net/ipv6/addrconf.c
>> @@ -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);
> 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
>
You're right, I missed this. I was a little to fast, sorry.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-03-31 19:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-31 18:47 [PATCH] ipv6: simplify code structure in addrconf.c/manage_tempaddrs Heiner Kallweit
2014-03-31 19:21 ` Hannes Frederic Sowa
2014-03-31 19:27 ` Heiner Kallweit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).