From owner-svn-src-stable-7@FreeBSD.ORG Mon Jul 26 18:55:19 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0484A1065690; Mon, 26 Jul 2010 18:55:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CD7A98FC13; Mon, 26 Jul 2010 18:55:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o6QItISb056352; Mon, 26 Jul 2010 18:55:18 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6QItIBc056350; Mon, 26 Jul 2010 18:55:18 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201007261855.o6QItIBc056350@svn.freebsd.org> From: John Baldwin Date: Mon, 26 Jul 2010 18:55:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210513 - stable/7/sys/nfsclient X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2010 18:55:19 -0000 Author: jhb Date: Mon Jul 26 18:55:18 2010 New Revision: 210513 URL: http://svn.freebsd.org/changeset/base/210513 Log: MFC 209948: A previous change moved the GETATTR RPC for open() calls that hit in the name cache up into nfs_lookup() instead of nfs_open(). Continue this trend by flushing the attribute cache for leaf nodes in nfs_lookup() during an open() if we do a LOOKUP RPC. For NFSv3 this should generally be a NOP as the attributes are flushed before fetching the post-op attributes from the LOOKUP RPC which most (all?) NFSv3 servers provide, so the post-op attributes should populate the cache. Now all NFS open() calls will always clear the cached attributes during the nfs_lookup() prior to nfs_open() in the !NMODIFIED case to provide CTOC. As a result, we can remove the conditional flushing of the attribute cache from nfs_open(). Modified: stable/7/sys/nfsclient/nfs_vnops.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/nfsclient/nfs_vnops.c ============================================================================== --- stable/7/sys/nfsclient/nfs_vnops.c Mon Jul 26 18:54:56 2010 (r210512) +++ stable/7/sys/nfsclient/nfs_vnops.c Mon Jul 26 18:55:18 2010 (r210513) @@ -488,14 +488,6 @@ nfs_open(struct vop_open_args *ap) np->n_mtime = vattr.va_mtime; mtx_unlock(&np->n_mtx); } else { - struct thread *td = curthread; - - if (np->n_ac_ts_syscalls != td->td_syscalls || - np->n_ac_ts_tid != td->td_tid || - td->td_proc == NULL || - np->n_ac_ts_pid != td->td_proc->p_pid) { - np->n_attrstamp = 0; - } mtx_unlock(&np->n_mtx); error = VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_td); if (error) @@ -1031,6 +1023,19 @@ nfs_lookup(struct vop_lookup_args *ap) return (error); } newvp = NFSTOV(np); + + /* + * Flush the attribute cache when opening a leaf node + * to ensure that fresh attributes are fetched in + * nfs_open() if we are unable to fetch attributes + * from the LOOKUP reply. + */ + if ((flags & (ISLASTCN | ISOPEN)) == (ISLASTCN | ISOPEN) && + !(np->n_flag & NMODIFIED)) { + mtx_lock(&np->n_mtx); + np->n_attrstamp = 0; + mtx_unlock(&np->n_mtx); + } } if (v3) { nfsm_postop_attr(newvp, attrflag);