Re: [PATCH] NFS: Fix RCU warnings in nfs_inode_return_delegation_noreclaim() [ver #2]

Paul E. McKenney
2010-03-31T18:30:34Z

On Wed, Mar 31, 2010 at 06:37:34PM +0100, David Howells wrote:
> Paul E. McKenney <paulmck@linux.vnet.ibm.com> wrote:
>
> > Protected by something that the caller did, be it holding the the correct
> > lock, operating on it during initialization before other CPUs have access
> > to it, operating on it during cleanup after other CPUs' access has been
> > revoked, or whatever.
>
> But the point I made very early this morning still stands: What if someone
> simply wants to test the pointer, not actually to dereference it?

OK, I was missing your point. And this is what you were proposing
rcu_pointer_not_null() for.

> NFS was using rcu_dereference() for this in a couple of places - which is
> overkill. I suggested stripping this off and you countered with the
> suggestion that it should be using rcu_dereference_check().
>
> Why do I need anything at all?

Right now you don't. We will need something as part of Arnd's patches to
shut sparse up, and I was hoping not to have to go through the find/fix
cycle twice. But that turned out to be kind of pointless, since we
have burned far more time discussing than it would have taken to fix
it twice. ;-)

But the discussion has been helpful, as I was previously just fine with
sprinkling otherwise-unneed rcu_dereference_whatever() calls thoughout
the kernel!

Thanx, Paul