diff options
author | zack <zack@FreeBSD.org> | 2011-07-16 08:51:09 +0000 |
---|---|---|
committer | zack <zack@FreeBSD.org> | 2011-07-16 08:51:09 +0000 |
commit | 1fab7143c5a0cf07ad84fe178bb29590f5cd2733 (patch) | |
tree | 692e5096886a1c840f65311eb5a7921341945941 /sys/fs/nfs/nfs_commonport.c | |
parent | cbcc560b1ef4e3268956232dcc43c9f45bbb9e42 (diff) | |
download | FreeBSD-src-1fab7143c5a0cf07ad84fe178bb29590f5cd2733.zip FreeBSD-src-1fab7143c5a0cf07ad84fe178bb29590f5cd2733.tar.gz |
Add DEXITCODE plumbing to NFS.
Isilon has the concept of an in-memory exit-code ring that saves the last exit
code of a function and allows for stack tracing. This is very helpful when
debugging tough issues.
This patch is essentially a no-op for BSD at this point, until we upstream
the dexitcode logic itself. The patch adds DEXITCODE calls to every NFS
function that returns an errno error code. A number of code paths were also
reorganized to have single exit paths, to reduce code duplication.
Submitted by: David Kwan <dkwan@isilon.com>
Reviewed by: rmacklem
Approved by: zml (mentor)
MFC after: 2 weeks
Diffstat (limited to 'sys/fs/nfs/nfs_commonport.c')
-rw-r--r-- | sys/fs/nfs/nfs_commonport.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/sys/fs/nfs/nfs_commonport.c b/sys/fs/nfs/nfs_commonport.c index 2853854..4935b70 100644 --- a/sys/fs/nfs/nfs_commonport.c +++ b/sys/fs/nfs/nfs_commonport.c @@ -329,6 +329,7 @@ nfsvno_pathconf(struct vnode *vp, int flag, register_t *retf, }; error = 0; } + NFSEXITCODE(error); return (error); } @@ -427,6 +428,7 @@ nfssvc_nfscommon(struct thread *td, struct nfssvc_args *uap) int error; error = nfssvc_call(td, uap, td->td_ucred); + NFSEXITCODE(error); return (error); } @@ -439,9 +441,9 @@ nfssvc_call(struct thread *p, struct nfssvc_args *uap, struct ucred *cred) if (uap->flag & NFSSVC_IDNAME) { error = copyin(uap->argp, (caddr_t)&nid, sizeof (nid)); if (error) - return (error); + goto out; error = nfssvc_idname(&nid); - return (error); + goto out; } else if (uap->flag & NFSSVC_GETSTATS) { error = copyout(&newnfsstats, CAST_USER_ADDR_T(uap->argp), sizeof (newnfsstats)); @@ -503,7 +505,7 @@ nfssvc_call(struct thread *p, struct nfssvc_args *uap, struct ucred *cred) sizeof(newnfsstats.cbrpccnt)); } } - return (error); + goto out; } else if (uap->flag & NFSSVC_NFSUSERDPORT) { u_short sockport; @@ -515,6 +517,9 @@ nfssvc_call(struct thread *p, struct nfssvc_args *uap, struct ucred *cred) nfsrv_nfsuserddelport(); error = 0; } + +out: + NFSEXITCODE(error); return (error); } @@ -569,7 +574,7 @@ nfscommon_modevent(module_t mod, int type, void *data) switch (type) { case MOD_LOAD: if (loaded) - return (0); + goto out; newnfs_portinit(); mtx_init(&nfs_nameid_mutex, "nfs_nameid_mutex", NULL, MTX_DEF); mtx_init(&nfs_sockl_mutex, "nfs_sockl_mutex", NULL, MTX_DEF); @@ -606,6 +611,9 @@ nfscommon_modevent(module_t mod, int type, void *data) error = EOPNOTSUPP; break; } + +out: + NFSEXITCODE(error); return error; } static moduledata_t nfscommon_mod = { |