[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100401143944.GA2472@linux.vnet.ibm.com>
Date: Thu, 1 Apr 2010 07:39:44 -0700
From: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To: David Howells <dhowells@...hat.com>
Cc: Eric Dumazet <eric.dumazet@...il.com>, Trond.Myklebust@...app.com,
linux-nfs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] NFS: Fix RCU warnings in
nfs_inode_return_delegation_noreclaim() [ver #2]
On Thu, Apr 01, 2010 at 12:45:14PM +0100, David Howells wrote:
> Paul E. McKenney <paulmck@...ux.vnet.ibm.com> wrote:
>
> > > I think it is incorrectly used. Given that the rcu_dereference() in:
> > >
> > > if (rcu_dereference(nfsi->delegation) != NULL) {
> > > spin_lock(&clp->cl_lock);
> > > delegation = nfs_detach_delegation_locked(nfsi, NULL);
> > > spin_unlock(&clp->cl_lock);
> > > if (delegation != NULL)
> > > nfs_do_return_delegation(inode, delegation, 0);
> > > }
> >
> > And nfs_detach_delegation_locked() rechecks nfsi->delegation() under
> > the lock, so this is a legitimate use.
> >
> > The pointer is not held constant, but any changes will be accounted
> > for and handled correctly. So I would argue that the pointer value is
> > in fact protected by the recheck-under-lock algorithm used here.
>
> A legitimate use of what?
A legitimate use of loading an RCU-protected pointer without
smp_read_barrier_depends(). However, I could imagine some situations
where the ACCESS_ONCE() semantics were required -- though in this
particular situation, I am having a hard time seeing how the compiler
could mess us up. That said, my time on the C++ standards committee
has given me new respect for the perversity of compiler writers.
So you have objected to needless memory barriers. How do you feel
about possibly needless ACCESS_ONCE() calls?
Thanx, Paul
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists