From 046b7e33e34bbeb4ab9a143f0d4fa1a8151fcae6 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Thu, 16 Jul 2009 17:03:55 -0700 Subject: [PATCH] NFS - Fix refactor bugs. * The new ERROROUT macro unconditionally overwrites error. Don't use it for cases where we wish to retain a prior error. --- sys/vfs/nfs/nfs_vnops.c | 26 +++++++++++++++++++++----- 1 files changed, 21 insertions(+), 5 deletions(-) diff --git a/sys/vfs/nfs/nfs_vnops.c b/sys/vfs/nfs/nfs_vnops.c index f7a62ae..6a113f1 100644 --- a/sys/vfs/nfs/nfs_vnops.c +++ b/sys/vfs/nfs/nfs_vnops.c @@ -876,6 +876,7 @@ nfs_nresolve(struct vop_nresolve_args *ap) int attrflag; int fhsize; int error; + int tmp_error; int len; struct nfsm_info info; @@ -907,11 +908,18 @@ nfs_nresolve(struct vop_nresolve_args *ap) * to uncache the negative hit as soon as possible, but * we cannot simply destroy the entry because it is used * as a placeholder by the caller. + * + * The refactored nfs code will overwrite a non-zero error + * with 0 when we use ERROROUT(), so don't here. */ if (error == ENOENT) nfs_cache_setvp(ap->a_nch, NULL, nfsneg_cache_timeout); - ERROROUT(nfsm_postop_attr(&info, dvp, &attrflag, - NFS_LATTR_NOSHRINK)); + tmp_error = nfsm_postop_attr(&info, dvp, &attrflag, + NFS_LATTR_NOSHRINK); + if (tmp_error) { + error = tmp_error; + goto nfsmout; + } m_freem(info.mrep); info.mrep = NULL; goto nfsmout; @@ -989,11 +997,14 @@ nfs_lookup(struct vop_old_lookup_args *ap) long len; nfsfh_t *fhp; struct nfsnode *np; - int lockparent, wantparent, error = 0, attrflag, fhsize; + int lockparent, wantparent, attrflag, fhsize; + int error; + int tmp_error; struct nfsm_info info; info.mrep = NULL; info.v3 = NFS_ISV3(dvp); + error = 0; /* * Read-only mount check and directory check. @@ -1032,8 +1043,13 @@ nfs_lookup(struct vop_old_lookup_args *ap) NEGKEEPOUT(nfsm_request(&info, dvp, NFSPROC_LOOKUP, cnp->cn_td, cnp->cn_cred, &error)); if (error) { - ERROROUT(nfsm_postop_attr(&info, dvp, &attrflag, - NFS_LATTR_NOSHRINK)); + tmp_error = nfsm_postop_attr(&info, dvp, &attrflag, + NFS_LATTR_NOSHRINK); + if (tmp_error) { + error = tmp_error; + goto nfsmout; + } + m_freem(info.mrep); info.mrep = NULL; goto nfsmout; -- 1.7.7.2