From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753490Ab0DAOjy (ORCPT ); Thu, 1 Apr 2010 10:39:54 -0400 Received: from e5.ny.us.ibm.com ([32.97.182.145]:40701 "EHLO e5.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751396Ab0DAOjq (ORCPT ); Thu, 1 Apr 2010 10:39:46 -0400 Date: Thu, 1 Apr 2010 07:39:44 -0700 From: "Paul E. McKenney" To: David Howells Cc: Eric Dumazet , Trond.Myklebust@netapp.com, linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] NFS: Fix RCU warnings in nfs_inode_return_delegation_noreclaim() [ver #2] Message-ID: <20100401143944.GA2472@linux.vnet.ibm.com> Reply-To: paulmck@linux.vnet.ibm.com References: <23274.1269893706@redhat.com> <25276.1269901350@redhat.com> <26760.1269903543@redhat.com> <20100329232636.GT2569@linux.vnet.ibm.com> <2440.1269967151@redhat.com> <21972.1269993064@redhat.com> <10818.1270044273@redhat.com> <15371.1270057054@redhat.com> <19556.1270076008@redhat.com> <14003.1270122314@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <14003.1270122314@redhat.com> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 01, 2010 at 12:45:14PM +0100, David Howells wrote: > Paul E. McKenney 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