diff options
author | kib <kib@FreeBSD.org> | 2008-04-16 11:33:32 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2008-04-16 11:33:32 +0000 |
commit | 52243403eb48561abd7b33995f5a4be6a56fa1f0 (patch) | |
tree | 8616e51dd9b0325c0f52f09db6fcfd6bd22753bc /sys/kern/vfs_subr.c | |
parent | 0e16b52aecb9efb40df3384931b2f3afe0d44466 (diff) | |
download | FreeBSD-src-52243403eb48561abd7b33995f5a4be6a56fa1f0.zip FreeBSD-src-52243403eb48561abd7b33995f5a4be6a56fa1f0.tar.gz |
Move the head of byte-level advisory lock list from the
filesystem-specific vnode data to the struct vnode. Provide the
default implementation for the vop_advlock and vop_advlockasync.
Purge the locks on the vnode reclaim by using the lf_purgelocks().
The default implementation is augmented for the nfs and smbfs.
In the nfs_advlock, push the Giant inside the nfs_dolock.
Before the change, the vop_advlock and vop_advlockasync have taken the
unlocked vnode and dereferenced the fs-private inode data, racing with
with the vnode reclamation due to forced unmount. Now, the vop_getattr
under the shared vnode lock is used to obtain the inode size, and
later, in the lf_advlockasync, after locking the vnode interlock, the
VI_DOOMED flag is checked to prevent an operation on the doomed vnode.
The implementation of the lf_purgelocks() is submitted by dfr.
Reported by: kris
Tested by: kris, pho
Discussed with: jeff, dfr
MFC after: 2 weeks
Diffstat (limited to 'sys/kern/vfs_subr.c')
-rw-r--r-- | sys/kern/vfs_subr.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 11a78b7..0fbfccc 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include <sys/kdb.h> #include <sys/kernel.h> #include <sys/kthread.h> +#include <sys/lockf.h> #include <sys/malloc.h> #include <sys/mount.h> #include <sys/namei.h> @@ -2524,6 +2525,10 @@ vgonel(struct vnode *vp) VNASSERT(vp->v_object == NULL, vp, ("vop_reclaim left v_object vp=%p, tag=%s", vp, vp->v_tag)); /* + * Clear the advisory locks and wake up waiting threads. + */ + lf_purgelocks(vp, &(vp->v_lockf)); + /* * Delete from old mount point vnode list. */ delmntque(vp); |