From owner-svn-src-head@FreeBSD.ORG Tue Mar 24 23:16:48 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8DA1A1065672; Tue, 24 Mar 2009 23:16:48 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 606768FC22; Tue, 24 Mar 2009 23:16:48 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2ONGmrh059439; Tue, 24 Mar 2009 23:16:48 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2ONGmdb059436; Tue, 24 Mar 2009 23:16:48 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903242316.n2ONGmdb059436@svn.freebsd.org> From: Robert Watson Date: Tue, 24 Mar 2009 23:16:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190396 - head/sys/nfsclient X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Mar 2009 23:16:50 -0000 Author: rwatson Date: Tue Mar 24 23:16:48 2009 New Revision: 190396 URL: http://svn.freebsd.org/changeset/base/190396 Log: Fix two bugs in DTrace tracing of accesscache and attrcache load events: - Trace non-error loads into the access cache once, not zero times or twice. - Sometimes attr cache loads fail due to a race, in which case they are aborted leading to an invalidation; in this case, trace only the flush, not a load. MFC after: 1 month Sponsored by: Google, Inc. Modified: head/sys/nfsclient/nfs_kdtrace.h head/sys/nfsclient/nfs_subs.c head/sys/nfsclient/nfs_vnops.c Modified: head/sys/nfsclient/nfs_kdtrace.h ============================================================================== --- head/sys/nfsclient/nfs_kdtrace.h Tue Mar 24 22:35:05 2009 (r190395) +++ head/sys/nfsclient/nfs_kdtrace.h Tue Mar 24 23:16:48 2009 (r190396) @@ -64,8 +64,7 @@ extern uint32_t nfsclient_accesscache_lo } while (0) #define KDTRACE_NFS_ACCESSCACHE_LOAD_DONE(vp, uid, rmode, error) do { \ - if (error && dtrace_nfsclient_accesscache_load_done_probe != \ - NULL) \ + if (dtrace_nfsclient_accesscache_load_done_probe != NULL) \ (dtrace_nfsclient_accesscache_load_done_probe)( \ nfsclient_accesscache_load_done_id, (vp), (uid), \ (rmode), (error)); \ Modified: head/sys/nfsclient/nfs_subs.c ============================================================================== --- head/sys/nfsclient/nfs_subs.c Tue Mar 24 22:35:05 2009 (r190395) +++ head/sys/nfsclient/nfs_subs.c Tue Mar 24 23:16:48 2009 (r190396) @@ -755,12 +755,16 @@ nfs_loadattrcache(struct vnode **vpp, st vaper->va_mtime = np->n_mtim; } } + +#ifdef KDTRACE_HOOKS + if (np->n_attrstamp != 0) + KDTRACE_NFS_ATTRCACHE_LOAD_DONE(vp, &np->n_vattr, 0); +#endif mtx_unlock(&np->n_mtx); out: -#ifdef KDRACE_HOOKS - if (np != NULL) - KDTRACE_NFS_ATTRCACHE_LOAD_DONE(vp, error == 0 ? &np->n_vattr - : NULL, error); +#ifdef KDTRACE_HOOKS + if (error) + KDTRACE_NFS_ATTRCACHE_LOAD_DONE(vp, NULL, error); #endif return (error); } Modified: head/sys/nfsclient/nfs_vnops.c ============================================================================== --- head/sys/nfsclient/nfs_vnops.c Tue Mar 24 22:35:05 2009 (r190395) +++ head/sys/nfsclient/nfs_vnops.c Tue Mar 24 23:16:48 2009 (r190396) @@ -339,7 +339,12 @@ nfs3_access_otw(struct vnode *vp, int wm } m_freem(mrep); nfsmout: - KDTRACE_NFS_ACCESSCACHE_LOAD_DONE(vp, cred->cr_uid, 0, error); +#ifdef KDTRACE_HOOKS + if (error) { + KDTRACE_NFS_ACCESSCACHE_LOAD_DONE(vp, cred->cr_uid, 0, + error); + } +#endif return (error); }