1 Apr 2010 03:29
Re: [PATCH] NFS: Fix RCU warnings in nfs_inode_return_delegation_noreclaim() [ver #2]
On Wed, Mar 31, 2010 at 11:53:28PM +0100, David Howells wrote: > Eric Dumazet <eric.dumazet@...> wrote: > > > If you dont own a lock, and test a pointer, what guarantee do you have > > this pointer doesnt change right after you tested it ? > > There are five possibilities: > > (1) A pointer points to something when you check, and still points to the > same thing after you've gained the lock. > > (2) A pointer points to something when you check, and points to something > else after you've gained the lock. > > (3) A pointer points to something when you check, and is NULL after you've > gained the lock. > > (4) A pointer points to NULL when you check, and points to something after > you've gained the lock. > > (5) A pointer points to NULL when you check, and points to NULL after you've > gained the lock. > > However, what if you _know_ that the pointer can only ever be made non-NULL > during initialisation, and may even be left unset? That means possibility (4) > can never happen, and that possibility (5) can be detected by testing before > taking the lock. Now, what if (5) is a common occurrence? It might make > sense to make the test. > > And what matter if the pointer _does_ change after you test it. If it was(Continue reading)
RSS Feed