Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1336898 > unrolled thread

[PATCH] ipv6: Annotate change of locking mechanism for np->opt

Started byBenjamin Poirier <bpoirier@suse.com>
First post2016-02-18 01:30 +0100
Last post2016-02-18 21:30 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] ipv6: Annotate change of locking mechanism for np->opt Benjamin Poirier <bpoirier@suse.com> - 2016-02-18 01:30 +0100
    Re: [PATCH] ipv6: Annotate change of locking mechanism for np->opt Eric Dumazet <eric.dumazet@gmail.com> - 2016-02-18 09:10 +0100
    Re: [PATCH] ipv6: Annotate change of locking mechanism for np->opt David Miller <davem@davemloft.net> - 2016-02-18 21:30 +0100

#1336898 — [PATCH] ipv6: Annotate change of locking mechanism for np->opt

FromBenjamin Poirier <bpoirier@suse.com>
Date2016-02-18 01:30 +0100
Subject[PATCH] ipv6: Annotate change of locking mechanism for np->opt
Message-ID<r3kDL-5JG-5@gated-at.bofh.it>
follows up commit 45f6fad84cc3 ("ipv6: add complete rcu protection around
np->opt") which added mixed rcu/refcount protection to np->opt.

Given the current implementation of rcu_pointer_handoff(), this has no
effect at runtime.

Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
---
 include/net/ipv6.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 6570f37..f3c9857 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -259,8 +259,12 @@ static inline struct ipv6_txoptions *txopt_get(const struct ipv6_pinfo *np)
 
 	rcu_read_lock();
 	opt = rcu_dereference(np->opt);
-	if (opt && !atomic_inc_not_zero(&opt->refcnt))
-		opt = NULL;
+	if (opt) {
+		if (!atomic_inc_not_zero(&opt->refcnt))
+			opt = NULL;
+		else
+			opt = rcu_pointer_handoff(opt);
+	}
 	rcu_read_unlock();
 	return opt;
 }
-- 
2.7.0

[toc] | [next] | [standalone]


#1337118

FromEric Dumazet <eric.dumazet@gmail.com>
Date2016-02-18 09:10 +0100
Message-ID<r3rOV-2FS-13@gated-at.bofh.it>
In reply to#1336898
On mer., 2016-02-17 at 16:20 -0800, Benjamin Poirier wrote:
> follows up commit 45f6fad84cc3 ("ipv6: add complete rcu protection around
> np->opt") which added mixed rcu/refcount protection to np->opt.
> 
> Given the current implementation of rcu_pointer_handoff(), this has no
> effect at runtime.
> 
> Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
> ---

LGTM

Acked-by: Eric Dumazet <edumazet@google.com>

[toc] | [prev] | [next] | [standalone]


#1337714

FromDavid Miller <davem@davemloft.net>
Date2016-02-18 21:30 +0100
Message-ID<r3Dn6-2Bf-51@gated-at.bofh.it>
In reply to#1336898
From: Benjamin Poirier <bpoirier@suse.com>
Date: Wed, 17 Feb 2016 16:20:33 -0800

> follows up commit 45f6fad84cc3 ("ipv6: add complete rcu protection around
> np->opt") which added mixed rcu/refcount protection to np->opt.
> 
> Given the current implementation of rcu_pointer_handoff(), this has no
> effect at runtime.
> 
> Signed-off-by: Benjamin Poirier <bpoirier@suse.com>

Since it has no effect on run-time, applied to net-next, thanks.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web