Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/nfs remove SAVESTART from the symlink, mknod and create ...
details: https://anonhg.NetBSD.org/src/rev/3150be5d4ddd
branches: trunk
changeset: 515378:3150be5d4ddd
user: chs <chs%NetBSD.org@localhost>
date: Sun Sep 23 01:37:03 2001 +0000
description:
remove SAVESTART from the symlink, mknod and create operations.
it was unnecessary, and removing it also fixes a v_usecount leak
that was introduced in the previous revision.
diffstat:
sys/nfs/nfs_serv.c | 49 +++++--------------------------------------------
1 files changed, 5 insertions(+), 44 deletions(-)
diffs (196 lines):
diff -r 8f4b1a41c9c6 -r 3150be5d4ddd sys/nfs/nfs_serv.c
--- a/sys/nfs/nfs_serv.c Sat Sep 22 22:49:32 2001 +0000
+++ b/sys/nfs/nfs_serv.c Sun Sep 23 01:37:03 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nfs_serv.c,v 1.60 2001/07/24 15:39:33 assar Exp $ */
+/* $NetBSD: nfs_serv.c,v 1.61 2001/09/23 01:37:03 chs Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -1312,7 +1312,7 @@
nfsm_srvnamesiz(len);
nd.ni_cnd.cn_cred = cred;
nd.ni_cnd.cn_nameiop = CREATE;
- nd.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF | SAVESTART;
+ nd.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF;
error = nfs_namei(&nd, fhp, len, slp, nam, &md, &dpos,
&dirp, procp, (nfsd->nd_flag & ND_KERBAUTH), FALSE);
if (dirp) {
@@ -1382,11 +1382,9 @@
*/
if (nd.ni_vp == NULL) {
if (va.va_type == VREG || va.va_type == VSOCK) {
- vrele(nd.ni_startdir);
nqsrv_getl(nd.ni_dvp, ND_WRITE);
error = VOP_CREATE(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &va);
if (!error) {
- PNBUF_PUT(nd.ni_cnd.cn_pnbuf);
if (exclusive_flag) {
exclusive_flag = 0;
VATTR_NULL(&va);
@@ -1402,8 +1400,6 @@
va.va_type = VFIFO;
if (va.va_type != VFIFO &&
(error = suser(cred, (u_short *)0))) {
- vrele(nd.ni_startdir);
- PNBUF_PUT(nd.ni_cnd.cn_pnbuf);
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
vput(nd.ni_dvp);
nfsm_reply(0);
@@ -1414,7 +1410,6 @@
error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd,
&va);
if (error) {
- vrele(nd.ni_startdir);
nfsm_reply(0);
}
PNBUF_PUT(nd.ni_cnd.cn_pnbuf);
@@ -1426,16 +1421,12 @@
nfsm_reply(0);
}
} else {
- vrele(nd.ni_startdir);
- PNBUF_PUT(nd.ni_cnd.cn_pnbuf);
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
vput(nd.ni_dvp);
error = ENXIO;
}
vp = nd.ni_vp;
} else {
- vrele(nd.ni_startdir);
- PNBUF_PUT(nd.ni_cnd.cn_pnbuf);
vp = nd.ni_vp;
if (nd.ni_dvp == vp)
vrele(nd.ni_dvp);
@@ -1488,10 +1479,6 @@
nfsmout:
if (dirp)
vrele(dirp);
- if (nd.ni_cnd.cn_nameiop) {
- vrele(nd.ni_startdir);
- PNBUF_PUT(nd.ni_cnd.cn_pnbuf);
- }
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
if (nd.ni_dvp == nd.ni_vp)
vrele(nd.ni_dvp);
@@ -1537,7 +1524,7 @@
nfsm_srvnamesiz(len);
nd.ni_cnd.cn_cred = cred;
nd.ni_cnd.cn_nameiop = CREATE;
- nd.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF | SAVESTART;
+ nd.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF;
error = nfs_namei(&nd, fhp, len, slp, nam, &md, &dpos,
&dirp, procp, (nfsd->nd_flag & ND_KERBAUTH), FALSE);
if (dirp)
@@ -1552,8 +1539,6 @@
nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED);
vtyp = nfsv3tov_type(*tl);
if (vtyp != VCHR && vtyp != VBLK && vtyp != VSOCK && vtyp != VFIFO) {
- vrele(nd.ni_startdir);
- PNBUF_PUT(nd.ni_cnd.cn_pnbuf);
error = NFSERR_BADTYPE;
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
if (nd.ni_dvp == nd.ni_vp)
@@ -1577,8 +1562,6 @@
* Iff doesn't exist, create it.
*/
if (nd.ni_vp) {
- vrele(nd.ni_startdir);
- PNBUF_PUT(nd.ni_cnd.cn_pnbuf);
error = EEXIST;
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
if (nd.ni_dvp == nd.ni_vp)
@@ -1590,16 +1573,11 @@
}
va.va_type = vtyp;
if (vtyp == VSOCK) {
- vrele(nd.ni_startdir);
nqsrv_getl(nd.ni_dvp, ND_WRITE);
error = VOP_CREATE(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &va);
- if (!error)
- PNBUF_PUT(nd.ni_cnd.cn_pnbuf);
} else {
if (va.va_type != VFIFO &&
(error = suser(cred, (u_short *)0))) {
- vrele(nd.ni_startdir);
- PNBUF_PUT(nd.ni_cnd.cn_pnbuf);
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
vput(nd.ni_dvp);
goto out;
@@ -1607,14 +1585,11 @@
nqsrv_getl(nd.ni_dvp, ND_WRITE);
error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &va);
if (error) {
- vrele(nd.ni_startdir);
goto out;
}
- PNBUF_PUT(nd.ni_cnd.cn_pnbuf);
if (error)
goto out;
if (nd.ni_cnd.cn_flags & ISSYMLINK) {
- vrele(nd.ni_dvp);
vput(nd.ni_vp);
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
error = EINVAL;
@@ -1642,10 +1617,6 @@
nfsmout:
if (dirp)
vrele(dirp);
- if (nd.ni_cnd.cn_nameiop) {
- vrele(nd.ni_startdir);
- PNBUF_PUT(nd.ni_cnd.cn_pnbuf);
- }
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
if (nd.ni_dvp == nd.ni_vp)
vrele(nd.ni_dvp);
@@ -2081,7 +2052,7 @@
nfsm_srvnamesiz(len);
nd.ni_cnd.cn_cred = cred;
nd.ni_cnd.cn_nameiop = CREATE;
- nd.ni_cnd.cn_flags = LOCKPARENT | SAVESTART;
+ nd.ni_cnd.cn_flags = LOCKPARENT;
error = nfs_namei(&nd, fhp, len, slp, nam, &md, &dpos,
&dirp, procp, (nfsd->nd_flag & ND_KERBAUTH), FALSE);
if (dirp) {
@@ -2116,8 +2087,6 @@
}
*(pathcp + len2) = '\0';
if (nd.ni_vp) {
- vrele(nd.ni_startdir);
- PNBUF_PUT(nd.ni_cnd.cn_pnbuf);
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
if (nd.ni_dvp == nd.ni_vp)
vrele(nd.ni_dvp);
@@ -2129,9 +2098,7 @@
}
nqsrv_getl(nd.ni_dvp, ND_WRITE);
error = VOP_SYMLINK(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &va, pathcp);
- if (error)
- vrele(nd.ni_startdir);
- else {
+ if (!error) {
if (v3) {
memset((caddr_t)fhp, 0, sizeof(nfh));
fhp->fh_fsid = nd.ni_vp->v_mount->mnt_stat.f_fsid;
@@ -2141,10 +2108,8 @@
procp);
vput(nd.ni_vp);
} else {
- vrele(nd.ni_startdir);
vput(nd.ni_vp);
}
- PNBUF_PUT(nd.ni_cnd.cn_pnbuf);
}
out:
if (pathcp)
@@ -2163,10 +2128,6 @@
}
return (0);
nfsmout:
- if (nd.ni_cnd.cn_nameiop) {
- vrele(nd.ni_startdir);
- PNBUF_PUT(nd.ni_cnd.cn_pnbuf);
- }
if (dirp)
vrele(dirp);
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
Home |
Main Index |
Thread Index |
Old Index