summaryrefslogtreecommitdiffstats
path: root/sys/nfs
diff options
context:
space:
mode:
authordillon <dillon@FreeBSD.org>1999-02-13 09:47:30 +0000
committerdillon <dillon@FreeBSD.org>1999-02-13 09:47:30 +0000
commit717990555d6eb2c99c783d07582260843bd89944 (patch)
treefc6b98304def69a46aaf09a8cbde881a02bfed5f /sys/nfs
parent39fab1fa0c7ff28dc67e8d12909c65f41e837926 (diff)
downloadFreeBSD-src-717990555d6eb2c99c783d07582260843bd89944.zip
FreeBSD-src-717990555d6eb2c99c783d07582260843bd89944.tar.gz
General additional cleanup of VOP API for NFS ops - mainly NFS ignoring
the API for freeing up cnp's. This cleanup should not effect nominal operation one way or the other since NFS VOPs just happen to be called with flags that match what it actually does to the NAMEI components it gets. Still, if an NFS error occured, there was probably some memory leakage of NAMEI components with certain NFS VOP ops.
Diffstat (limited to 'sys/nfs')
-rw-r--r--sys/nfs/nfs_vnops.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c
index f74ae54..1531a71 100644
--- a/sys/nfs/nfs_vnops.c
+++ b/sys/nfs/nfs_vnops.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_vnops.c 8.16 (Berkeley) 5/27/95
- * $Id: nfs_vnops.c,v 1.120 1999/02/06 07:48:56 dillon Exp $
+ * $Id: nfs_vnops.c,v 1.121 1999/02/13 08:01:59 dillon Exp $
*/
@@ -1409,7 +1409,8 @@ again:
cache_enter(dvp, newvp, cnp);
*ap->a_vpp = newvp;
}
- zfree(namei_zone, cnp->cn_pnbuf);
+ if (error || (cnp->cn_flags & SAVESTART) == 0)
+ zfree(namei_zone, cnp->cn_pnbuf);
VTONFS(dvp)->n_flag |= NMODIFIED;
if (!wccflag)
VTONFS(dvp)->n_attrstamp = 0;
@@ -1601,12 +1602,14 @@ nfs_rename(ap)
}
out:
+ VOP_ABORTOP(tdvp, tcnp);
if (tdvp == tvp)
vrele(tdvp);
else
vput(tdvp);
if (tvp)
vput(tvp);
+ VOP_ABORTOP(fdvp, fcnp);
vrele(fdvp);
vrele(fvp);
/*
@@ -1790,7 +1793,6 @@ nfs_symlink(ap)
nfsm_reqdone;
if (newvp)
vput(newvp);
- zfree(namei_zone, cnp->cn_pnbuf);
VTONFS(dvp)->n_flag |= NMODIFIED;
if (!wccflag)
VTONFS(dvp)->n_attrstamp = 0;
@@ -1799,6 +1801,12 @@ nfs_symlink(ap)
*/
if (error == EEXIST)
error = 0;
+ /*
+ * cnp's buffer expected to be freed if SAVESTART not set or
+ * if an error was returned.
+ */
+ if (error || (cnp->cn_flags & SAVESTART) == 0)
+ zfree(namei_zone, cnp->cn_pnbuf);
return (error);
}
@@ -1883,7 +1891,8 @@ nfs_mkdir(ap)
vrele(newvp);
} else
*ap->a_vpp = newvp;
- zfree(namei_zone, cnp->cn_pnbuf);
+ if (error || (cnp->cn_flags & SAVESTART) == 0)
+ zfree(namei_zone, cnp->cn_pnbuf);
return (error);
}
OpenPOWER on IntegriCloud