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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le mercredi 31 mars 2010 à 18:37 +0100, David Howells a écrit :
> Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx> 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?
> 
> 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().
> 

If pointer has the rcu mark, and somehing access this pointer without
proper locking, then automatic checkers (sparse...) will trigger a
warning, this is what Paul said.

Example of such checks, 

# define __percpu   __attribute__((noderef, address_space(3))) 

If someone tries to manipulate a __percpu marked ptr without proper API,
sparse loudly complains.


> Why do I need anything at all?
> 

If you dont own a lock, and test a pointer, what guarantee do you have
this pointer doesnt change right after you tested it ?

If *something* protects the pointer from being changed, then how can be
expressed this fact ?

If nothing protects the pointer, why test it then, as result of test is
unreliable ?

If NFS was using rcu_dereference(), it probably was for a reason, but if
nobody can recall it, it was a wrong reason ?

Sorry, too many questions and no answer I guess...



--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux