netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nf_nat_h323.c unneeded rcu_dereference() calls
@ 2007-10-29 21:06 Paul E. McKenney
  2007-10-30 14:06 ` Patrick McHardy
  0 siblings, 1 reply; 3+ messages in thread
From: Paul E. McKenney @ 2007-10-29 21:06 UTC (permalink / raw)
  To: linux-kernel, netdev; +Cc: rusty, zhaojingmin, davem

Hello!

While reviewing rcu_dereference() uses, I came across a number of cases
where I couldn't see how the rcu_dereference() helped.  One class of
cases is where the variable is never subsequently dereferenced, so that
patches like the following one would be appropriate.

So, what am I missing here?

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---

 nf_nat_h323.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff -urpNa -X dontdiff linux-2.6.23/net/ipv4/netfilter/nf_nat_h323.c linux-2.6.23-rcufix/net/ipv4/netfilter/nf_nat_h323.c
--- linux-2.6.23/net/ipv4/netfilter/nf_nat_h323.c	2007-10-09 13:31:38.000000000 -0700
+++ linux-2.6.23-rcufix/net/ipv4/netfilter/nf_nat_h323.c	2007-10-29 14:00:13.000000000 -0700
@@ -546,15 +546,15 @@ static int nat_callforwarding(struct sk_
 /****************************************************************************/
 static int __init init(void)
 {
-	BUG_ON(rcu_dereference(set_h245_addr_hook) != NULL);
-	BUG_ON(rcu_dereference(set_h225_addr_hook) != NULL);
-	BUG_ON(rcu_dereference(set_sig_addr_hook) != NULL);
-	BUG_ON(rcu_dereference(set_ras_addr_hook) != NULL);
-	BUG_ON(rcu_dereference(nat_rtp_rtcp_hook) != NULL);
-	BUG_ON(rcu_dereference(nat_t120_hook) != NULL);
-	BUG_ON(rcu_dereference(nat_h245_hook) != NULL);
-	BUG_ON(rcu_dereference(nat_callforwarding_hook) != NULL);
-	BUG_ON(rcu_dereference(nat_q931_hook) != NULL);
+	BUG_ON(set_h245_addr_hook != NULL);
+	BUG_ON(set_h225_addr_hook != NULL);
+	BUG_ON(set_sig_addr_hook != NULL);
+	BUG_ON(set_ras_addr_hook != NULL);
+	BUG_ON(nat_rtp_rtcp_hook != NULL);
+	BUG_ON(nat_t120_hook != NULL);
+	BUG_ON(nat_h245_hook != NULL);
+	BUG_ON(nat_callforwarding_hook != NULL);
+	BUG_ON(nat_q931_hook != NULL);
 
 	rcu_assign_pointer(set_h245_addr_hook, set_h245_addr);
 	rcu_assign_pointer(set_h225_addr_hook, set_h225_addr);

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

* Re: [PATCH] nf_nat_h323.c unneeded rcu_dereference() calls
  2007-10-29 21:06 [PATCH] nf_nat_h323.c unneeded rcu_dereference() calls Paul E. McKenney
@ 2007-10-30 14:06 ` Patrick McHardy
  2007-10-30 15:37   ` Paul E. McKenney
  0 siblings, 1 reply; 3+ messages in thread
From: Patrick McHardy @ 2007-10-30 14:06 UTC (permalink / raw)
  To: paulmck; +Cc: linux-kernel, netdev, rusty, zhaojingmin, davem

Paul E. McKenney wrote:
> Hello!
> 
> While reviewing rcu_dereference() uses, I came across a number of cases
> where I couldn't see how the rcu_dereference() helped.  One class of
> cases is where the variable is never subsequently dereferenced, so that
> patches like the following one would be appropriate.
> 
> So, what am I missing here?


Nothing, it was mainly intended as documentation that the hooks are
protected by RCU. I agree that its probably more confusing this way
since we're not even in a rcu_read_lock protected section.

I've queued a patch to remove them all.

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

* Re: [PATCH] nf_nat_h323.c unneeded rcu_dereference() calls
  2007-10-30 14:06 ` Patrick McHardy
@ 2007-10-30 15:37   ` Paul E. McKenney
  0 siblings, 0 replies; 3+ messages in thread
From: Paul E. McKenney @ 2007-10-30 15:37 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: linux-kernel, netdev, rusty, zhaojingmin, davem

On Tue, Oct 30, 2007 at 03:06:20PM +0100, Patrick McHardy wrote:
> Paul E. McKenney wrote:
> >Hello!
> >
> >While reviewing rcu_dereference() uses, I came across a number of cases
> >where I couldn't see how the rcu_dereference() helped.  One class of
> >cases is where the variable is never subsequently dereferenced, so that
> >patches like the following one would be appropriate.
> >
> >So, what am I missing here?
> 
> Nothing, it was mainly intended as documentation that the hooks are
> protected by RCU. I agree that its probably more confusing this way
> since we're not even in a rcu_read_lock protected section.
> 
> I've queued a patch to remove them all.

Thank you!!!

						Thanx, Paul

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

end of thread, other threads:[~2007-10-30 15:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-29 21:06 [PATCH] nf_nat_h323.c unneeded rcu_dereference() calls Paul E. McKenney
2007-10-30 14:06 ` Patrick McHardy
2007-10-30 15:37   ` Paul E. McKenney

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).