summaryrefslogtreecommitdiffstats
path: root/sys/ufs
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2008-04-16 11:33:32 +0000
committerkib <kib@FreeBSD.org>2008-04-16 11:33:32 +0000
commit52243403eb48561abd7b33995f5a4be6a56fa1f0 (patch)
tree8616e51dd9b0325c0f52f09db6fcfd6bd22753bc /sys/ufs
parent0e16b52aecb9efb40df3384931b2f3afe0d44466 (diff)
downloadFreeBSD-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/ufs')
-rw-r--r--sys/ufs/ufs/inode.h1
-rw-r--r--sys/ufs/ufs/ufs_vnops.c41
2 files changed, 0 insertions, 42 deletions
diff --git a/sys/ufs/ufs/inode.h b/sys/ufs/ufs/inode.h
index 2fc3336..b198758 100644
--- a/sys/ufs/ufs/inode.h
+++ b/sys/ufs/ufs/inode.h
@@ -75,7 +75,6 @@ struct inode {
struct fs *i_fs; /* Associated filesystem superblock. */
struct dquot *i_dquot[MAXQUOTAS]; /* Dquot structures. */
u_quad_t i_modrev; /* Revision level for NFS lease. */
- struct lockf *i_lockf;/* Head of byte-level lock list. */
/*
* Side effects; used during directory lookup.
*/
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c
index d65d1fb..5028975 100644
--- a/sys/ufs/ufs/ufs_vnops.c
+++ b/sys/ufs/ufs/ufs_vnops.c
@@ -91,8 +91,6 @@ __FBSDID("$FreeBSD$");
#include <ufs/ffs/ffs_extern.h>
static vop_access_t ufs_access;
-static vop_advlock_t ufs_advlock;
-static vop_advlockasync_t ufs_advlockasync;
static int ufs_chmod(struct vnode *, int, struct ucred *, struct thread *);
static int ufs_chown(struct vnode *, uid_t, gid_t, struct ucred *, struct thread *);
static vop_close_t ufs_close;
@@ -2165,43 +2163,6 @@ ufs_pathconf(ap)
}
/*
- * Advisory record locking support
- */
-static int
-ufs_advlock(ap)
- struct vop_advlock_args /* {
- struct vnode *a_vp;
- caddr_t a_id;
- int a_op;
- struct flock *a_fl;
- int a_flags;
- } */ *ap;
-{
- struct inode *ip = VTOI(ap->a_vp);
-
- return (lf_advlock(ap, &(ip->i_lockf), ip->i_size));
-}
-
-/*
- * Advisory record locking support
- */
-static int
-ufs_advlockasync(ap)
- struct vop_advlockasync_args /* {
- struct vnode *a_vp;
- caddr_t a_id;
- int a_op;
- struct flock *a_fl;
- int a_flags;
- struct task *a_task;
- } */ *ap;
-{
- struct inode *ip = VTOI(ap->a_vp);
-
- return (lf_advlockasync(ap, &(ip->i_lockf), ip->i_size));
-}
-
-/*
* Initialize the vnode associated with a new inode, handle aliased
* vnodes.
*/
@@ -2468,8 +2429,6 @@ struct vop_vector ufs_vnodeops = {
.vop_reallocblks = VOP_PANIC,
.vop_write = VOP_PANIC,
.vop_access = ufs_access,
- .vop_advlock = ufs_advlock,
- .vop_advlockasync = ufs_advlockasync,
.vop_bmap = ufs_bmap,
.vop_cachedlookup = ufs_lookup,
.vop_close = ufs_close,
OpenPOWER on IntegriCloud