Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/nfs Don't forget to unlock the vnode returned by cache_l...
details: https://anonhg.NetBSD.org/src/rev/0ff6307aa42d
branches: trunk
changeset: 508813:0ff6307aa42d
user: fvdl <fvdl%NetBSD.org@localhost>
date: Fri Apr 20 11:22:02 2001 +0000
description:
Don't forget to unlock the vnode returned by cache_lookup if the
subsequent access check fails. Don't overwrite the error code
returned by cache_lookup. Remove a piece of redundant code.
Should fix kern/12680.
diffstat:
sys/nfs/nfs_vnops.c | 19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)
diffs (46 lines):
diff -r e520f81c27e8 -r 0ff6307aa42d sys/nfs/nfs_vnops.c
--- a/sys/nfs/nfs_vnops.c Fri Apr 20 11:19:51 2001 +0000
+++ b/sys/nfs/nfs_vnops.c Fri Apr 20 11:22:02 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nfs_vnops.c,v 1.130 2001/02/11 01:09:04 enami Exp $ */
+/* $NetBSD: nfs_vnops.c,v 1.131 2001/04/20 11:22:02 fvdl Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -840,16 +840,22 @@
}
if (cnp->cn_flags & PDIRUNLOCK) {
- error = vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
- if (error) {
+ err2 = vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
+ if (err2 != 0) {
*vpp = NULLVP;
- return error;
+ return err2;
}
cnp->cn_flags &= ~PDIRUNLOCK;
}
err2 = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, cnp->cn_proc);
- if (err2) {
+ if (err2 != 0) {
+ if (error == 0) {
+ if (*vpp != dvp)
+ vput(*vpp);
+ else
+ vrele(*vpp);
+ }
*vpp = NULLVP;
return err2;
}
@@ -862,9 +868,6 @@
cache_purge(dvp);
np->n_nctime = 0;
goto dorpc;
- } else if (error > 0) {
- *vpp = NULLVP;
- return error;
}
newvp = *vpp;
Home |
Main Index |
Thread Index |
Old Index