summaryrefslogtreecommitdiffstats
path: root/sys/gnu
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/gnu
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/gnu')
-rw-r--r--sys/gnu/fs/ext2fs/ext2_vnops.c20
-rw-r--r--sys/gnu/fs/ext2fs/inode.h1
-rw-r--r--sys/gnu/fs/xfs/FreeBSD/xfs_vnops.c6
3 files changed, 3 insertions, 24 deletions
diff --git a/sys/gnu/fs/ext2fs/ext2_vnops.c b/sys/gnu/fs/ext2fs/ext2_vnops.c
index eaf7443..76d2cc1 100644
--- a/sys/gnu/fs/ext2fs/ext2_vnops.c
+++ b/sys/gnu/fs/ext2fs/ext2_vnops.c
@@ -83,7 +83,6 @@
static int ext2_makeinode(int mode, struct vnode *, struct vnode **, struct componentname *);
static vop_access_t ext2_access;
-static vop_advlock_t ext2_advlock;
static int ext2_chmod(struct vnode *, int, struct ucred *, struct thread *);
static int ext2_chown(struct vnode *, uid_t, gid_t, struct ucred *,
struct thread *);
@@ -119,7 +118,6 @@ static void filt_ext2detach(struct knote *kn);
struct vop_vector ext2_vnodeops = {
.vop_default = &default_vnodeops,
.vop_access = ext2_access,
- .vop_advlock = ext2_advlock,
.vop_bmap = ext2_bmap,
.vop_cachedlookup = ext2_lookup,
.vop_close = ext2_close,
@@ -1521,24 +1519,6 @@ ext2_pathconf(ap)
}
/*
- * Advisory record locking support
- */
-static int
-ext2_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));
-}
-
-/*
* Vnode pointer to File handle
*/
/* ARGSUSED */
diff --git a/sys/gnu/fs/ext2fs/inode.h b/sys/gnu/fs/ext2fs/inode.h
index 9ba5546..75d9b1b 100644
--- a/sys/gnu/fs/ext2fs/inode.h
+++ b/sys/gnu/fs/ext2fs/inode.h
@@ -68,7 +68,6 @@ struct inode {
struct ext2_sb_info *i_e2fs; /* EXT2FS */
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/gnu/fs/xfs/FreeBSD/xfs_vnops.c b/sys/gnu/fs/xfs/FreeBSD/xfs_vnops.c
index 90a0b48..1027416 100644
--- a/sys/gnu/fs/xfs/FreeBSD/xfs_vnops.c
+++ b/sys/gnu/fs/xfs/FreeBSD/xfs_vnops.c
@@ -1231,13 +1231,13 @@ _xfs_advlock(
#ifdef notyet
switch (ap->a_op) {
case F_SETLK:
- error = lf_advlock(ap, &np->n_lockf, size);
+ error = lf_advlock(ap, &vp->v_lockf, size);
break;
case F_UNLCK:
- lf_advlock(ap, &np->n_lockf, size);
+ lf_advlock(ap, &vp->v_lockf, size);
break;
case F_GETLK:
- error = lf_advlock(ap, &np->n_lockf, size);
+ error = lf_advlock(ap, &vp->v_lockf, size);
break;
default:
return (EINVAL);
OpenPOWER on IntegriCloud