Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/miscfs/genfs improve genfs_eopnotsupp_rele() so that's u...
details: https://anonhg.NetBSD.org/src/rev/a4c6e3e5d437
branches: trunk
changeset: 545556:a4c6e3e5d437
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Thu Apr 10 21:34:12 2003 +0000
description:
improve genfs_eopnotsupp_rele() so that's usable for vop_rename,
which uses WILLPUT for member which may be NULL
handle correctly dvp == vp case for WILLPUT members, so this works
for vop_remove, vop_rename
thanks Bill Studenmund for code&comments on this
diffstat:
sys/miscfs/genfs/genfs_vnops.c | 23 +++++++++++++++++------
1 files changed, 17 insertions(+), 6 deletions(-)
diffs (60 lines):
diff -r 9c5b0b15c561 -r a4c6e3e5d437 sys/miscfs/genfs/genfs_vnops.c
--- a/sys/miscfs/genfs/genfs_vnops.c Thu Apr 10 20:57:01 2003 +0000
+++ b/sys/miscfs/genfs/genfs_vnops.c Thu Apr 10 21:34:12 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: genfs_vnops.c,v 1.73 2003/02/25 20:35:38 thorpej Exp $ */
+/* $NetBSD: genfs_vnops.c,v 1.74 2003/04/10 21:34:12 jdolecek Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.73 2003/02/25 20:35:38 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.74 2003/04/10 21:34:12 jdolecek Exp $");
#include "opt_nfsserver.h"
@@ -192,8 +192,8 @@
}
/*
- * Called when an fs doesn't support a particular vop but the vop needs to
- * vrele, vput, or vunlock passed in vnodes.
+ * Called when an fs doesn't support a particular vop.
+ * This takes care to vrele, vput, or vunlock passed in vnodes.
*/
int
genfs_eopnotsupp_rele(void *v)
@@ -203,7 +203,7 @@
/ * other random data follows, presumably * /
} */ *ap = v;
struct vnodeop_desc *desc = ap->a_desc;
- struct vnode *vp;
+ struct vnode *vp, *vp_last = NULL;
int flags, i, j, offset;
flags = desc->vdesc_flags;
@@ -212,9 +212,20 @@
break; /* stop at end of list */
if ((j = flags & VDESC_VP0_WILLPUT)) {
vp = *VOPARG_OFFSETTO(struct vnode **, offset, ap);
+
+ /* Skip if NULL */
+ if (!vp)
+ continue;
+
switch (j) {
case VDESC_VP0_WILLPUT:
- vput(vp);
+ /* Check for dvp == vp cases */
+ if (vp == vp_last)
+ vrele(vp);
+ else {
+ vput(vp);
+ vp_last = vp;
+ }
break;
case VDESC_VP0_WILLUNLOCK:
VOP_UNLOCK(vp, 0);
Home |
Main Index |
Thread Index |
Old Index