From 4ce73d70968875fa0c07f07e90a2bdcb84726bd6 Mon Sep 17 00:00:00 2001 From: eivind Date: Sat, 13 Nov 1999 20:58:17 +0000 Subject: Remove WILLRELE from VOP_SYMLINK Note: Previous commit to these files (except coda_vnops and devfs_vnops) that claimed to remove WILLRELE from VOP_RENAME actually removed it from VOP_MKNOD. --- sys/nfs/nfs_serv.c | 21 ++++++--------------- sys/nfs/nfs_vnops.c | 4 +++- 2 files changed, 9 insertions(+), 16 deletions(-) (limited to 'sys/nfs') diff --git a/sys/nfs/nfs_serv.c b/sys/nfs/nfs_serv.c index 681c3a6..122e7f3 100644 --- a/sys/nfs/nfs_serv.c +++ b/sys/nfs/nfs_serv.c @@ -68,13 +68,10 @@ * error occurs. If no error occurs, the VOP_*() routines only free * the path component if SAVESTART is NOT set. * - * VOP_SYMLINK, lookup(), and namei() + * lookup() and namei() * may return garbage in various structural fields/return elements * if an error is returned, and may garbage up nd.ni_dvp even if no * error is returned and you did not request LOCKPARENT or WANTPARENT. - * VOP_SYMLINK return garbage in its return vnode (i.e. not - * something we need to release) even if no error occurs. Our cleanup - * code is sensitive to garbage, so we have to carefully clear it out. * * We use the ni_cnd.cn_flags 'HASBUF' flag to track whether the name * buffer has been freed or not. This is unique to nfs_serv.c for @@ -1699,10 +1696,6 @@ nfsrv_create(nfsd, slp, procp, mrq) nd.ni_cnd.cn_flags &= ~HASBUF; goto nfsmreply0; } - - /* - * release vp we do not use - */ vput(nd.ni_vp); nd.ni_vp = NULL; @@ -1912,10 +1905,6 @@ nfsrv_mknod(nfsd, slp, procp, mrq) nd.ni_cnd.cn_flags &= ~HASBUF; goto out; } - - /* - * release vp we do not use - */ vput(nd.ni_vp); nd.ni_vp = NULL; @@ -2559,14 +2548,16 @@ nfsrv_symlink(nfsd, slp, procp, mrq) /* * issue symlink op. SAVESTART is set so the underlying path component - * is only freed by the VOP if an error occurs. VOP_SYMLINK does not - * return a referenced ni_vp, but it may fill the pointer with garbage. + * is only freed by the VOP if an error occurs. */ nqsrv_getl(nd.ni_dvp, ND_WRITE); error = VOP_SYMLINK(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap, pathcp); - nd.ni_vp = NULL; if (error) nd.ni_cnd.cn_flags &= ~HASBUF; + else { + vput(nd.ni_vp); + nd.ni_vp = NULL; + } /* * releases directory prior to potential lookup op. */ diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c index 816273e..b8fbc8b 100644 --- a/sys/nfs/nfs_vnops.c +++ b/sys/nfs/nfs_vnops.c @@ -1818,8 +1818,10 @@ nfs_symlink(ap) nfsm_wcc_data(dvp, wccflag); } nfsm_reqdone; - if (newvp) + if (newvp && error) vput(newvp); + else + *ap->a_vpp = newvp; VTONFS(dvp)->n_flag |= NMODIFIED; if (!wccflag) VTONFS(dvp)->n_attrstamp = 0; -- cgit v1.1