Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/fs/union Handle v_writecount from union_open(), union_cl...
details: https://anonhg.NetBSD.org/src/rev/b7e0372e726c
branches: trunk
changeset: 351933:b7e0372e726c
user: hannken <hannken%NetBSD.org@localhost>
date: Mon Mar 06 10:08:49 2017 +0000
description:
Handle v_writecount from union_open(), union_close() and union_revoke()
so lower file system vnodes get marked as open for writing.
diffstat:
sys/fs/union/union_vnops.c | 27 ++++++++++++++++++++++++---
1 files changed, 24 insertions(+), 3 deletions(-)
diffs (70 lines):
diff -r c2afdd6693a1 -r b7e0372e726c sys/fs/union/union_vnops.c
--- a/sys/fs/union/union_vnops.c Mon Mar 06 10:07:52 2017 +0000
+++ b/sys/fs/union/union_vnops.c Mon Mar 06 10:08:49 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: union_vnops.c,v 1.63 2015/04/20 23:03:08 riastradh Exp $ */
+/* $NetBSD: union_vnops.c,v 1.64 2017/03/06 10:08:49 hannken Exp $ */
/*
* Copyright (c) 1992, 1993, 1994, 1995
@@ -72,7 +72,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.63 2015/04/20 23:03:08 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.64 2017/03/06 10:08:49 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -616,6 +616,11 @@
error = union_copyup(un, (mode&O_TRUNC) == 0, cred, l);
if (error == 0)
error = VOP_OPEN(un->un_uppervp, mode, cred);
+ if (error == 0) {
+ mutex_enter(un->un_uppervp->v_interlock);
+ un->un_uppervp->v_writecount++;
+ mutex_exit(un->un_uppervp->v_interlock);
+ }
return (error);
}
@@ -640,6 +645,11 @@
return ENXIO;
error = VOP_OPEN(tvp, mode, cred);
+ if (error == 0 && (ap->a_mode & FWRITE)) {
+ mutex_enter(tvp->v_interlock);
+ tvp->v_writecount++;
+ mutex_exit(tvp->v_interlock);
+ }
return (error);
}
@@ -669,6 +679,12 @@
KASSERT(vp != NULLVP);
ap->a_vp = vp;
+ if ((ap->a_fflag & FWRITE)) {
+ KASSERT(vp == un->un_uppervp);
+ mutex_enter(vp->v_interlock);
+ vp->v_writecount--;
+ mutex_exit(vp->v_interlock);
+ }
if (do_lock)
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
error = VCALL(vp, VOFFSET(vop_close), ap);
@@ -1048,8 +1064,13 @@
} */ *ap = v;
struct vnode *vp = ap->a_vp;
- if (UPPERVP(vp))
+ if (UPPERVP(vp)) {
+ mutex_enter(UPPERVP(vp)->v_interlock);
+ KASSERT(vp->v_interlock == UPPERVP(vp)->v_interlock);
+ UPPERVP(vp)->v_writecount -= vp->v_writecount;
+ mutex_exit(UPPERVP(vp)->v_interlock);
VOP_REVOKE(UPPERVP(vp), ap->a_flags);
+ }
if (LOWERVP(vp))
VOP_REVOKE(LOWERVP(vp), ap->a_flags);
vgone(vp); /* XXXAD?? */
Home |
Main Index |
Thread Index |
Old Index