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/fs/tmpfs | |
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/fs/tmpfs')
-rw-r--r-- | sys/fs/tmpfs/tmpfs.h | 3 | ||||
-rw-r--r-- | sys/fs/tmpfs/tmpfs_vfsops.c | 1 | ||||
-rw-r--r-- | sys/fs/tmpfs/tmpfs_vnops.c | 32 |
3 files changed, 0 insertions, 36 deletions
diff --git a/sys/fs/tmpfs/tmpfs.h b/sys/fs/tmpfs/tmpfs.h index d730e9e..fd0001e 100644 --- a/sys/fs/tmpfs/tmpfs.h +++ b/sys/fs/tmpfs/tmpfs.h @@ -219,9 +219,6 @@ struct tmpfs_node { struct timespec tn_birthtime; unsigned long tn_gen; - /* Head of byte-level lock list (used by tmpfs_advlock). */ - struct lockf * tn_lockf; - /* As there is a single vnode for each active file within the * system, care has to be taken to avoid allocating more than one * vnode per file. In order to do this, a bidirectional association diff --git a/sys/fs/tmpfs/tmpfs_vfsops.c b/sys/fs/tmpfs/tmpfs_vfsops.c index b5fbd3c..a14558b 100644 --- a/sys/fs/tmpfs/tmpfs_vfsops.c +++ b/sys/fs/tmpfs/tmpfs_vfsops.c @@ -151,7 +151,6 @@ tmpfs_node_ctor(void *mem, int size, void *arg, int flags) node->tn_status = 0; node->tn_flags = 0; node->tn_links = 0; - node->tn_lockf = NULL; node->tn_vnode = NULL; node->tn_vpstate = 0; diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index f50af94..719a5de 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -1429,36 +1429,6 @@ tmpfs_pathconf(struct vop_pathconf_args *v) return error; } -/* --------------------------------------------------------------------- */ - -static int -tmpfs_advlock(struct vop_advlock_args *v) -{ - struct vnode *vp = v->a_vp; - - struct tmpfs_node *node; - - node = VP_TO_TMPFS_NODE(vp); - - return lf_advlock(v, &node->tn_lockf, node->tn_size); -} - -/* --------------------------------------------------------------------- */ - -static int -tmpfs_advlockasync(struct vop_advlockasync_args *v) -{ - struct vnode *vp = v->a_vp; - - struct tmpfs_node *node; - - node = VP_TO_TMPFS_NODE(vp); - - return lf_advlockasync(v, &node->tn_lockf, node->tn_size); -} - -/* --------------------------------------------------------------------- */ - static int tmpfs_vptofh(struct vop_vptofh_args *ap) { @@ -1506,8 +1476,6 @@ struct vop_vector tmpfs_vnodeop_entries = { .vop_reclaim = tmpfs_reclaim, .vop_print = tmpfs_print, .vop_pathconf = tmpfs_pathconf, - .vop_advlock = tmpfs_advlock, - .vop_advlockasync = tmpfs_advlockasync, .vop_vptofh = tmpfs_vptofh, .vop_bmap = VOP_EOPNOTSUPP, }; |