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.
This commit is contained in:
Robert Watson 2009-03-24 23:16:48 +00:00
parent c2a3620fc3
commit 346ef8cd59
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=190396
3 changed files with 15 additions and 7 deletions

View File

@ -64,8 +64,7 @@ extern uint32_t nfsclient_accesscache_load_done_id;
} 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)); \

View File

@ -755,12 +755,16 @@ nfs_loadattrcache(struct vnode **vpp, struct mbuf **mdp, caddr_t *dposp,
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);
}

View File

@ -339,7 +339,12 @@ nfs3_access_otw(struct vnode *vp, int wmode, struct thread *td,
}
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);
}