Subject: Re: vop_symlink and unused vpp?
To: Assar Westerlund <assar@netbsd.org>
From: Bill Studenmund <wrstuden@zembu.com>
List: tech-kern
Date: 07/17/2001 10:23:57
On 17 Jul 2001, Assar Westerlund wrote:
> These patches follow that line. I'll commit them if there are no
> objections.
No objections, just a suggestion. There are a few places where you added
if (error), but didn't indent the following vput. Please do so. Oh, also
please indent the nfs fragment too, though maybe only 4 characters to
prevent the line from wrapping. Your call.
Yea! One less vrele!
Don't forget to bump the kernel version.
Index: nfs/nfs_serv.c
===================================================================
RCS file: /cvsroot/syssrc/sys/nfs/nfs_serv.c,v
retrieving revision 1.59
diff -u -w -r1.59 nfs_serv.c
--- nfs/nfs_serv.c 2000/11/27 08:39:49 1.59
+++ nfs/nfs_serv.c 2001/07/17 09:08:44
@@ -2146,12 +2146,14 @@
vrele(nd.ni_startdir);
else {
if (v3) {
+ if (nd.ni_vp == NULL) {
nd.ni_cnd.cn_nameiop = LOOKUP;
nd.ni_cnd.cn_flags &= ~(LOCKPARENT | SAVESTART | FOLLOW);
nd.ni_cnd.cn_flags |= (NOFOLLOW | LOCKLEAF);
nd.ni_cnd.cn_proc = procp;
nd.ni_cnd.cn_cred = cred;
error = lookup(&nd);
+ }
if (!error) {
memset((caddr_t)fhp, 0, sizeof(nfh));
fhp->fh_fsid = nd.ni_vp->v_mount->mnt_stat.f_fsid;
@@ -2161,8 +2163,11 @@
procp);
vput(nd.ni_vp);
}
- } else
+ } else {
vrele(nd.ni_startdir);
+ if (nd.ni_vp != NULL)
+ vput(nd.ni_vp);
+ }
PNBUF_PUT(nd.ni_cnd.cn_pnbuf);
}
out:
Index: ufs/ext2fs/ext2fs_vnops.c
===================================================================
RCS file: /cvsroot/syssrc/sys/ufs/ext2fs/ext2fs_vnops.c,v
retrieving revision 1.33
diff -u -w -r1.33 ext2fs_vnops.c
--- ufs/ext2fs/ext2fs_vnops.c 2001/03/23 21:11:08 1.33
+++ ufs/ext2fs/ext2fs_vnops.c 2001/07/17 09:08:45
@@ -1206,6 +1206,7 @@
error = vn_rdwr(UIO_WRITE, vp, ap->a_target, len, (off_t)0,
UIO_SYSSPACE, IO_NODELOCKED, ap->a_cnp->cn_cred,
(size_t *)0, (struct proc *)0);
+ if (error)
vput(vp);
return (error);
}
Index: ufs/ufs/ufs_vnops.c
===================================================================
RCS file: /cvsroot/syssrc/sys/ufs/ufs/ufs_vnops.c,v
retrieving revision 1.78
diff -u -w -r1.78 ufs_vnops.c
--- ufs/ufs/ufs_vnops.c 2001/05/28 02:50:53 1.78
+++ ufs/ufs/ufs_vnops.c 2001/07/17 09:08:45
@@ -1450,6 +1450,7 @@
error = vn_rdwr(UIO_WRITE, vp, ap->a_target, len, (off_t)0,
UIO_SYSSPACE, IO_NODELOCKED, ap->a_cnp->cn_cred, NULL,
(struct proc *)0);
+ if (error)
vput(vp);
return (error);
}
Thanks!
Take care,
Bill