Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Mar 2009 23:16:48 +0000 (UTC)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r190396 - head/sys/nfsclient
Message-ID:  <200903242316.n2ONGmdb059436@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903242316.n2ONGmdb059436>