summaryrefslogtreecommitdiff
path: root/sys/nfs
diff options
context:
space:
mode:
Diffstat (limited to 'sys/nfs')
-rw-r--r--sys/nfs/nfs_serv.c47
-rw-r--r--sys/nfs/nfs_subs.c7
-rw-r--r--sys/nfs/nfs_vnops.c21
3 files changed, 39 insertions, 36 deletions
diff --git a/sys/nfs/nfs_serv.c b/sys/nfs/nfs_serv.c
index a0cdc8349f7..928eb898aec 100644
--- a/sys/nfs/nfs_serv.c
+++ b/sys/nfs/nfs_serv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_serv.c,v 1.36 2003/08/15 20:32:20 tedu Exp $ */
+/* $OpenBSD: nfs_serv.c,v 1.37 2004/05/14 04:00:34 tedu Exp $ */
/* $NetBSD: nfs_serv.c,v 1.34 1997/05/12 23:37:12 fvdl Exp $ */
/*
@@ -68,6 +68,7 @@
#include <sys/dirent.h>
#include <sys/stat.h>
#include <sys/kernel.h>
+#include <sys/pool.h>
#include <ufs/ufs/dir.h>
#include <uvm/uvm_extern.h>
@@ -378,7 +379,7 @@ nfsrv_lookup(nfsd, slp, procp, mrq)
return (0);
}
vrele(nd.ni_startdir);
- FREE(nd.ni_cnd.cn_pnbuf, M_NAMEI);
+ pool_put(&namei_pool, nd.ni_cnd.cn_pnbuf);
vp = nd.ni_vp;
bzero((caddr_t)fhp, sizeof(nfh));
fhp->fh_fsid = vp->v_mount->mnt_stat.f_fsid;
@@ -1328,7 +1329,7 @@ nfsrv_create(nfsd, slp, procp, mrq)
vrele(nd.ni_startdir);
error = VOP_CREATE(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &va);
if (!error) {
- FREE(nd.ni_cnd.cn_pnbuf, M_NAMEI);
+ pool_put(&namei_pool, nd.ni_cnd.cn_pnbuf);
if (exclusive_flag) {
exclusive_flag = 0;
VATTR_NULL(&va);
@@ -1345,7 +1346,7 @@ nfsrv_create(nfsd, slp, procp, mrq)
if (va.va_type != VFIFO &&
(error = suser_ucred(cred))) {
vrele(nd.ni_startdir);
- free(nd.ni_cnd.cn_pnbuf, M_NAMEI);
+ pool_put(&namei_pool, nd.ni_cnd.cn_pnbuf);
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
vput(nd.ni_dvp);
nfsm_reply(0);
@@ -1356,7 +1357,7 @@ nfsrv_create(nfsd, slp, procp, mrq)
&va);
if (error) {
vrele(nd.ni_startdir);
- free(nd.ni_cnd.cn_pnbuf, M_NAMEI);
+ pool_put(&namei_pool, nd.ni_cnd.cn_pnbuf);
nfsm_reply(0);
return (0);
}
@@ -1365,12 +1366,12 @@ nfsrv_create(nfsd, slp, procp, mrq)
nd.ni_cnd.cn_proc = procp;
nd.ni_cnd.cn_cred = cred;
if ((error = lookup(&nd)) != 0) {
- free(nd.ni_cnd.cn_pnbuf, M_NAMEI);
+ pool_put(&namei_pool, nd.ni_cnd.cn_pnbuf);
nfsm_reply(0);
return (0);
}
- FREE(nd.ni_cnd.cn_pnbuf, M_NAMEI);
+ pool_put(&namei_pool, nd.ni_cnd.cn_pnbuf);
if (nd.ni_cnd.cn_flags & ISSYMLINK) {
vrele(nd.ni_dvp);
vput(nd.ni_vp);
@@ -1381,7 +1382,7 @@ nfsrv_create(nfsd, slp, procp, mrq)
}
} else {
vrele(nd.ni_startdir);
- free(nd.ni_cnd.cn_pnbuf, M_NAMEI);
+ pool_put(&namei_pool, nd.ni_cnd.cn_pnbuf);
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
vput(nd.ni_dvp);
error = ENXIO;
@@ -1389,7 +1390,7 @@ nfsrv_create(nfsd, slp, procp, mrq)
vp = nd.ni_vp;
} else {
vrele(nd.ni_startdir);
- free(nd.ni_cnd.cn_pnbuf, M_NAMEI);
+ pool_put(&namei_pool, nd.ni_cnd.cn_pnbuf);
vp = nd.ni_vp;
if (nd.ni_dvp == vp)
vrele(nd.ni_dvp);
@@ -1443,7 +1444,7 @@ nfsmout:
vrele(dirp);
if (nd.ni_cnd.cn_nameiop) {
vrele(nd.ni_startdir);
- free((caddr_t)nd.ni_cnd.cn_pnbuf, M_NAMEI);
+ pool_put(&namei_pool, nd.ni_cnd.cn_pnbuf);
}
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
if (nd.ni_dvp == nd.ni_vp)
@@ -1506,7 +1507,7 @@ nfsrv_mknod(nfsd, slp, procp, mrq)
vtyp = nfsv3tov_type(*tl);
if (vtyp != VCHR && vtyp != VBLK && vtyp != VSOCK && vtyp != VFIFO) {
vrele(nd.ni_startdir);
- free((caddr_t)nd.ni_cnd.cn_pnbuf, M_NAMEI);
+ pool_put(&namei_pool, nd.ni_cnd.cn_pnbuf);
error = NFSERR_BADTYPE;
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
vput(nd.ni_dvp);
@@ -1526,7 +1527,7 @@ nfsrv_mknod(nfsd, slp, procp, mrq)
*/
if (nd.ni_vp) {
vrele(nd.ni_startdir);
- free((caddr_t)nd.ni_cnd.cn_pnbuf, M_NAMEI);
+ pool_put(&namei_pool, nd.ni_cnd.cn_pnbuf);
error = EEXIST;
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
vput(nd.ni_dvp);
@@ -1537,12 +1538,12 @@ nfsrv_mknod(nfsd, slp, procp, mrq)
vrele(nd.ni_startdir);
error = VOP_CREATE(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &va);
if (!error)
- FREE(nd.ni_cnd.cn_pnbuf, M_NAMEI);
+ pool_put(&namei_pool, nd.ni_cnd.cn_pnbuf);
} else {
if (va.va_type != VFIFO &&
(error = suser_ucred(cred))) {
vrele(nd.ni_startdir);
- free((caddr_t)nd.ni_cnd.cn_pnbuf, M_NAMEI);
+ pool_put(&namei_pool, nd.ni_cnd.cn_pnbuf);
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
vput(nd.ni_dvp);
goto out;
@@ -1557,7 +1558,7 @@ nfsrv_mknod(nfsd, slp, procp, mrq)
nd.ni_cnd.cn_proc = procp;
nd.ni_cnd.cn_cred = procp->p_ucred;
error = lookup(&nd);
- FREE(nd.ni_cnd.cn_pnbuf, M_NAMEI);
+ pool_put(&namei_pool, nd.ni_cnd.cn_pnbuf);
if (error)
goto out;
if (nd.ni_cnd.cn_flags & ISSYMLINK) {
@@ -1591,7 +1592,7 @@ nfsmout:
vrele(dirp);
if (nd.ni_cnd.cn_nameiop) {
vrele(nd.ni_startdir);
- free((caddr_t)nd.ni_cnd.cn_pnbuf, M_NAMEI);
+ pool_put(&namei_pool, nd.ni_cnd.cn_pnbuf);
}
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
if (nd.ni_dvp == nd.ni_vp)
@@ -1829,7 +1830,7 @@ out:
error = 0;
}
vrele(tond.ni_startdir);
- FREE(tond.ni_cnd.cn_pnbuf, M_NAMEI);
+ pool_put(&namei_pool, tond.ni_cnd.cn_pnbuf);
out1:
if (fdirp) {
fdiraft_ret = VOP_GETATTR(fdirp, &fdiraft, cred, procp);
@@ -1840,7 +1841,7 @@ out1:
vrele(tdirp);
}
vrele(fromnd.ni_startdir);
- FREE(fromnd.ni_cnd.cn_pnbuf, M_NAMEI);
+ pool_put(&namei_pool, fromnd.ni_cnd.cn_pnbuf);
nfsm_reply(2 * NFSX_WCCDATA(v3));
if (v3) {
nfsm_srvwcc_data(fdirfor_ret, &fdirfor, fdiraft_ret, &fdiraft);
@@ -1855,11 +1856,11 @@ nfsmout:
vrele(tdirp);
if (tond.ni_cnd.cn_nameiop) {
vrele(tond.ni_startdir);
- FREE(tond.ni_cnd.cn_pnbuf, M_NAMEI);
+ pool_put(&namei_pool, tond.ni_cnd.cn_pnbuf);
}
if (fromnd.ni_cnd.cn_nameiop) {
vrele(fromnd.ni_startdir);
- FREE(fromnd.ni_cnd.cn_pnbuf, M_NAMEI);
+ pool_put(&namei_pool, fromnd.ni_cnd.cn_pnbuf);
VOP_ABORTOP(fromnd.ni_dvp, &fromnd.ni_cnd);
vrele(fromnd.ni_dvp);
vrele(fvp);
@@ -2035,7 +2036,7 @@ nfsrv_symlink(nfsd, slp, procp, mrq)
*(pathcp + len2) = '\0';
if (nd.ni_vp) {
vrele(nd.ni_startdir);
- free(nd.ni_cnd.cn_pnbuf, M_NAMEI);
+ pool_put(&namei_pool, nd.ni_cnd.cn_pnbuf);
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
if (nd.ni_dvp == nd.ni_vp)
vrele(nd.ni_dvp);
@@ -2067,7 +2068,7 @@ nfsrv_symlink(nfsd, slp, procp, mrq)
}
} else
vrele(nd.ni_startdir);
- FREE(nd.ni_cnd.cn_pnbuf, M_NAMEI);
+ pool_put(&namei_pool, nd.ni_cnd.cn_pnbuf);
}
out:
if (pathcp)
@@ -2088,7 +2089,7 @@ out:
nfsmout:
if (nd.ni_cnd.cn_nameiop) {
vrele(nd.ni_startdir);
- free(nd.ni_cnd.cn_pnbuf, M_NAMEI);
+ pool_put(&namei_pool, nd.ni_cnd.cn_pnbuf);
}
if (dirp)
vrele(dirp);
diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c
index 0ab1e612ba0..0cb86216853 100644
--- a/sys/nfs/nfs_subs.c
+++ b/sys/nfs/nfs_subs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_subs.c,v 1.43 2003/06/02 23:28:19 millert Exp $ */
+/* $OpenBSD: nfs_subs.c,v 1.44 2004/05/14 04:00:34 tedu Exp $ */
/* $NetBSD: nfs_subs.c,v 1.27.4.3 1996/07/08 20:34:24 jtc Exp $ */
/*
@@ -53,6 +53,7 @@
#include <sys/socketvar.h>
#include <sys/stat.h>
#include <sys/malloc.h>
+#include <sys/pool.h>
#include <sys/time.h>
#include <uvm/uvm_extern.h>
@@ -1355,7 +1356,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag)
struct componentname *cnp = &ndp->ni_cnd;
*retdirp = (struct vnode *)0;
- MALLOC(cnp->cn_pnbuf, char *, len + 1, M_NAMEI, M_WAITOK);
+ cnp->cn_pnbuf = pool_get(&namei_pool, PR_WAITOK);
/*
* Copy the name from the mbuf list to ndp->ni_pnbuf
* and set the various ndp fields appropriately.
@@ -1442,7 +1443,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag)
return (0);
}
out:
- FREE(cnp->cn_pnbuf, M_NAMEI);
+ pool_put(&namei_pool, cnp->cn_pnbuf);
return (error);
}
diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c
index 4a8ce4e0fa9..c54f7175049 100644
--- a/sys/nfs/nfs_vnops.c
+++ b/sys/nfs/nfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_vnops.c,v 1.59 2004/04/26 18:57:36 millert Exp $ */
+/* $OpenBSD: nfs_vnops.c,v 1.60 2004/05/14 04:00:34 tedu Exp $ */
/* $NetBSD: nfs_vnops.c,v 1.62.4.1 1996/07/08 20:26:52 jtc Exp $ */
/*
@@ -50,6 +50,7 @@
#include <sys/mount.h>
#include <sys/buf.h>
#include <sys/malloc.h>
+#include <sys/pool.h>
#include <sys/mbuf.h>
#include <sys/conf.h>
#include <sys/namei.h>
@@ -1205,7 +1206,7 @@ nfs_mknodrpc(dvp, vpp, cnp, vap)
cache_enter(dvp, newvp, cnp);
*vpp = newvp;
}
- FREE(cnp->cn_pnbuf, M_NAMEI);
+ pool_put(&namei_pool, cnp->cn_pnbuf);
VTONFS(dvp)->n_flag |= NMODIFIED;
if (!wccflag)
VTONFS(dvp)->n_attrstamp = 0;
@@ -1335,7 +1336,7 @@ again:
cache_enter(dvp, newvp, cnp);
*ap->a_vpp = newvp;
}
- FREE(cnp->cn_pnbuf, M_NAMEI);
+ pool_put(&namei_pool, cnp->cn_pnbuf);
VTONFS(dvp)->n_flag |= NMODIFIED;
if (!wccflag)
VTONFS(dvp)->n_attrstamp = 0;
@@ -1409,7 +1410,7 @@ nfs_remove(v)
error = 0;
} else if (!np->n_sillyrename)
error = nfs_sillyrename(dvp, vp, cnp);
- FREE(cnp->cn_pnbuf, M_NAMEI);
+ pool_put(&namei_pool, cnp->cn_pnbuf);
np->n_attrstamp = 0;
vrele(dvp);
vrele(vp);
@@ -1615,7 +1616,7 @@ nfs_link(v)
int v3;
if (dvp->v_mount != vp->v_mount) {
- FREE(cnp->cn_pnbuf, M_NAMEI);
+ pool_put(&namei_pool, cnp->cn_pnbuf);
if (vp == dvp)
vrele(dvp);
else
@@ -1643,7 +1644,7 @@ nfs_link(v)
nfsm_wcc_data(dvp, wccflag);
}
nfsm_reqdone;
- FREE(cnp->cn_pnbuf, M_NAMEI);
+ pool_put(&namei_pool, cnp->cn_pnbuf);
VTONFS(dvp)->n_flag |= NMODIFIED;
if (!attrflag)
VTONFS(vp)->n_attrstamp = 0;
@@ -1712,7 +1713,7 @@ nfs_symlink(v)
nfsm_reqdone;
if (newvp)
vrele(newvp);
- FREE(cnp->cn_pnbuf, M_NAMEI);
+ pool_put(&namei_pool, cnp->cn_pnbuf);
VTONFS(dvp)->n_flag |= NMODIFIED;
if (!wccflag)
VTONFS(dvp)->n_attrstamp = 0;
@@ -1802,7 +1803,7 @@ nfs_mkdir(v)
vrele(newvp);
} else
*ap->a_vpp = newvp;
- FREE(cnp->cn_pnbuf, M_NAMEI);
+ pool_put(&namei_pool, cnp->cn_pnbuf);
vrele(dvp);
return (error);
}
@@ -1833,7 +1834,7 @@ nfs_rmdir(v)
if (dvp == vp) {
vrele(dvp);
vrele(dvp);
- FREE(cnp->cn_pnbuf, M_NAMEI);
+ pool_put(&namei_pool, cnp->cn_pnbuf);
return (EINVAL);
}
nfsstats.rpccnt[NFSPROC_RMDIR]++;
@@ -1845,7 +1846,7 @@ nfs_rmdir(v)
if (v3)
nfsm_wcc_data(dvp, wccflag);
nfsm_reqdone;
- FREE(cnp->cn_pnbuf, M_NAMEI);
+ pool_put(&namei_pool, cnp->cn_pnbuf);
VTONFS(dvp)->n_flag |= NMODIFIED;
if (!wccflag)
VTONFS(dvp)->n_attrstamp = 0;