From 7fd32ea9230a6a5f7c1579179532be0bea782961 Mon Sep 17 00:00:00 2001 From: Zachary Loafman Date: Wed, 12 May 2010 21:24:46 +0000 Subject: [PATCH] Add VOP_ADVLOCKPURGE so that the file system is called when purging locks (in the case where the VFS impl isn't using lf_*) Submitted by: Matthew Fleming Reviewed by: zml, dfr --- sys/kern/vfs_default.c | 11 +++++++++++ sys/kern/vfs_subr.c | 2 +- sys/kern/vnode_if.src | 7 +++++++ sys/sys/vnode.h | 1 + 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index 37881475f89b..2d9a9082422e 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -98,6 +98,7 @@ struct vop_vector default_vnodeops = { .vop_accessx = vop_stdaccessx, .vop_advlock = vop_stdadvlock, .vop_advlockasync = vop_stdadvlockasync, + .vop_advlockpurge = vop_stdadvlockpurge, .vop_bmap = vop_stdbmap, .vop_close = VOP_NULL, .vop_fsync = VOP_NULL, @@ -413,6 +414,16 @@ vop_stdadvlockasync(struct vop_advlockasync_args *ap) return (lf_advlockasync(ap, &(vp->v_lockf), vattr.va_size)); } +int +vop_stdadvlockpurge(struct vop_advlockpurge_args *ap) +{ + struct vnode *vp; + + vp = ap->a_vp; + lf_purgelocks(vp, &vp->v_lockf); + return (0); +} + /* * vop_stdpathconf: * diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 1fb131acd448..d44b73567431 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -2585,7 +2585,7 @@ vgonel(struct vnode *vp) /* * Clear the advisory locks and wake up waiting threads. */ - lf_purgelocks(vp, &(vp->v_lockf)); + (void)VOP_ADVLOCKPURGE(vp); /* * Delete from old mount point vnode list. */ diff --git a/sys/kern/vnode_if.src b/sys/kern/vnode_if.src index c9f20e343bdb..304e00905c5a 100644 --- a/sys/kern/vnode_if.src +++ b/sys/kern/vnode_if.src @@ -453,6 +453,13 @@ vop_advlockasync { }; +%% advlockpurge vp E E E + +vop_advlockpurge { + IN struct vnode *vp; +}; + + %% reallocblks vp E E E vop_reallocblks { diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 64b3ce4e89e8..4c79ea530ff2 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -692,6 +692,7 @@ int vop_stdaccess(struct vop_access_args *ap); int vop_stdaccessx(struct vop_accessx_args *ap); int vop_stdadvlock(struct vop_advlock_args *ap); int vop_stdadvlockasync(struct vop_advlockasync_args *ap); +int vop_stdadvlockpurge(struct vop_advlockpurge_args *ap); int vop_stdpathconf(struct vop_pathconf_args *); int vop_stdpoll(struct vop_poll_args *); int vop_stdvptocnp(struct vop_vptocnp_args *ap);