summaryrefslogtreecommitdiffstats
path: root/sys/fs/unionfs/union_vnops.c
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2008-01-10 01:10:58 +0000
committerattilio <attilio@FreeBSD.org>2008-01-10 01:10:58 +0000
commit18d0a0dd51c7995ce9e549616f78ef724096b1bd (patch)
treec4e28d990eaa525916ab09f2bd1d9c6ddf2c8dea /sys/fs/unionfs/union_vnops.c
parent8df9c26bfdf7538c15226c902c07a0fe350ace36 (diff)
downloadFreeBSD-src-18d0a0dd51c7995ce9e549616f78ef724096b1bd.zip
FreeBSD-src-18d0a0dd51c7995ce9e549616f78ef724096b1bd.tar.gz
vn_lock() is currently only used with the 'curthread' passed as argument.
Remove this argument and pass curthread directly to underlying VOP_LOCK1() VFS method. This modify makes the code cleaner and in particular remove an annoying dependence helping next lockmgr() cleanup. KPI results, obviously, changed. Manpage and FreeBSD_version will be updated through further commits. As a side note, would be valuable to say that next commits will address a similar cleanup about VFS methods, in particular vop_lock1 and vop_unlock. Tested by: Diego Sardina <siarodx at gmail dot com>, Andrea Di Pasquale <whyx dot it at gmail dot com>
Diffstat (limited to 'sys/fs/unionfs/union_vnops.c')
-rw-r--r--sys/fs/unionfs/union_vnops.c45
1 files changed, 23 insertions, 22 deletions
diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c
index 74c90b1..2627111 100644
--- a/sys/fs/unionfs/union_vnops.c
+++ b/sys/fs/unionfs/union_vnops.c
@@ -146,7 +146,7 @@ unionfs_lookup(struct vop_cachedlookup_args *ap)
if (dtmpvp == udvp && ldvp != NULLVP) {
VOP_UNLOCK(udvp, 0, td);
- vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, td);
+ vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
}
if (error == 0) {
@@ -165,11 +165,12 @@ unionfs_lookup(struct vop_cachedlookup_args *ap)
vref(dunp->un_dvp);
if (nameiop == DELETE || nameiop == RENAME)
- vn_lock(dunp->un_dvp, LK_EXCLUSIVE | LK_RETRY, td);
+ vn_lock(dunp->un_dvp, LK_EXCLUSIVE | LK_RETRY);
else if (cnp->cn_lkflags & LK_TYPE_MASK)
- vn_lock(dunp->un_dvp, cnp->cn_lkflags | LK_RETRY, td);
+ vn_lock(dunp->un_dvp, cnp->cn_lkflags |
+ LK_RETRY);
- vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, td);
+ vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
} else if (error == ENOENT && (cnflags & MAKEENTRY) &&
nameiop != CREATE)
cache_enter(dvp, NULLVP, cnp);
@@ -278,7 +279,7 @@ unionfs_lookup(struct vop_cachedlookup_args *ap)
if (LK_SHARED == (cnp->cn_lkflags & LK_TYPE_MASK))
VOP_UNLOCK(vp, 0, td);
if (LK_EXCLUSIVE != VOP_ISLOCKED(vp, td)) {
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
lockflag = 1;
}
error = unionfs_mkshadowdir(MOUNTTOUNIONFSMOUNT(dvp->v_mount),
@@ -294,7 +295,7 @@ unionfs_lookup(struct vop_cachedlookup_args *ap)
goto unionfs_lookup_out;
}
if ((cnp->cn_lkflags & LK_TYPE_MASK) == LK_SHARED)
- vn_lock(vp, LK_SHARED | LK_RETRY, td);
+ vn_lock(vp, LK_SHARED | LK_RETRY);
}
/*
* get unionfs vnode.
@@ -314,7 +315,7 @@ unionfs_lookup(struct vop_cachedlookup_args *ap)
}
if ((nameiop == DELETE || nameiop == RENAME) &&
(cnp->cn_lkflags & LK_TYPE_MASK) == 0)
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
}
*(ap->a_vpp) = vp;
@@ -532,7 +533,7 @@ unionfs_close(struct vop_close_args *ap)
td = ap->a_td;
if (VOP_ISLOCKED(ap->a_vp, td) != LK_EXCLUSIVE) {
- vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY, td);
+ vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY);
locked = 1;
}
unionfs_get_node_status(unp, td, &unsp);
@@ -876,7 +877,7 @@ unionfs_ioctl(struct vop_ioctl_args *ap)
UNIONFS_INTERNAL_DEBUG("unionfs_ioctl: enter\n");
- vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY, ap->a_td);
+ vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY);
unp = VTOUNIONFS(ap->a_vp);
unionfs_get_node_status(unp, ap->a_td, &unsp);
ovp = (unsp->uns_upper_opencnt ? unp->un_uppervp : unp->un_lowervp);
@@ -901,7 +902,7 @@ unionfs_poll(struct vop_poll_args *ap)
struct unionfs_node_status *unsp;
struct vnode *ovp;
- vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY, ap->a_td);
+ vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY);
unp = VTOUNIONFS(ap->a_vp);
unionfs_get_node_status(unp, ap->a_td, &unsp);
ovp = (unsp->uns_upper_opencnt ? unp->un_uppervp : unp->un_lowervp);
@@ -1107,7 +1108,7 @@ unionfs_rename(struct vop_rename_args *ap)
if (unp->un_uppervp == NULLVP) {
switch (fvp->v_type) {
case VREG:
- if ((error = vn_lock(fvp, LK_EXCLUSIVE, td)) != 0)
+ if ((error = vn_lock(fvp, LK_EXCLUSIVE)) != 0)
goto unionfs_rename_abort;
error = unionfs_copyfile(unp, 1, fcnp->cn_cred, td);
VOP_UNLOCK(fvp, 0, td);
@@ -1115,7 +1116,7 @@ unionfs_rename(struct vop_rename_args *ap)
goto unionfs_rename_abort;
break;
case VDIR:
- if ((error = vn_lock(fvp, LK_EXCLUSIVE, td)) != 0)
+ if ((error = vn_lock(fvp, LK_EXCLUSIVE)) != 0)
goto unionfs_rename_abort;
error = unionfs_mkshadowdir(ump, rfdvp, unp, fcnp, td);
VOP_UNLOCK(fvp, 0, td);
@@ -1169,7 +1170,7 @@ unionfs_rename(struct vop_rename_args *ap)
}
if (needrelookup != 0) {
- if ((error = vn_lock(fdvp, LK_EXCLUSIVE, td)) != 0)
+ if ((error = vn_lock(fdvp, LK_EXCLUSIVE)) != 0)
goto unionfs_rename_abort;
error = unionfs_relookup_for_delete(fdvp, fcnp, td);
VOP_UNLOCK(fdvp, 0, td);
@@ -1181,7 +1182,7 @@ unionfs_rename(struct vop_rename_args *ap)
VOP_UNLOCK(tvp, 0, td);
error = unionfs_relookup_for_rename(tdvp, tcnp, td);
if (tvp != NULLVP && tvp != tdvp)
- vn_lock(tvp, LK_EXCLUSIVE | LK_RETRY, td);
+ vn_lock(tvp, LK_EXCLUSIVE | LK_RETRY);
if (error != 0)
goto unionfs_rename_abort;
}
@@ -1420,7 +1421,7 @@ unionfs_readdir(struct vop_readdir_args *ap)
/* check the open count. unionfs needs to open before readdir. */
if (VOP_ISLOCKED(ap->a_vp, td) != LK_EXCLUSIVE) {
- vn_lock(ap->a_vp, LK_UPGRADE | LK_RETRY, td);
+ vn_lock(ap->a_vp, LK_UPGRADE | LK_RETRY);
locked = 1;
}
unionfs_get_node_status(unp, td, &unsp);
@@ -1430,7 +1431,7 @@ unionfs_readdir(struct vop_readdir_args *ap)
error = EBADF;
}
if (locked == 1)
- vn_lock(ap->a_vp, LK_DOWNGRADE | LK_RETRY, td);
+ vn_lock(ap->a_vp, LK_DOWNGRADE | LK_RETRY);
if (error != 0)
goto unionfs_readdir_exit;
@@ -1752,7 +1753,7 @@ unionfs_lock(struct vop_lock1_args *ap)
if ((revlock & LK_TYPE_MASK) == LK_RELEASE)
VOP_UNLOCK(lvp, revlock, td);
else
- vn_lock(lvp, revlock | LK_RETRY, td);
+ vn_lock(lvp, revlock | LK_RETRY);
goto unionfs_lock_abort;
}
}
@@ -1872,7 +1873,7 @@ unionfs_advlock(struct vop_advlock_args *ap)
vp = ap->a_vp;
td = curthread;
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
unp = VTOUNIONFS(ap->a_vp);
uvp = unp->un_uppervp;
@@ -2024,12 +2025,12 @@ unionfs_openextattr(struct vop_openextattr_args *ap)
error = VOP_OPENEXTATTR(tvp, ap->a_cred, ap->a_td);
if (error == 0) {
- vn_lock(vp, LK_UPGRADE | LK_RETRY, ap->a_td);
+ vn_lock(vp, LK_UPGRADE | LK_RETRY);
if (tvp == unp->un_uppervp)
unp->un_flag |= UNIONFS_OPENEXTU;
else
unp->un_flag |= UNIONFS_OPENEXTL;
- vn_lock(vp, LK_DOWNGRADE | LK_RETRY, ap->a_td);
+ vn_lock(vp, LK_DOWNGRADE | LK_RETRY);
}
return (error);
@@ -2058,12 +2059,12 @@ unionfs_closeextattr(struct vop_closeextattr_args *ap)
error = VOP_CLOSEEXTATTR(tvp, ap->a_commit, ap->a_cred, ap->a_td);
if (error == 0) {
- vn_lock(vp, LK_UPGRADE | LK_RETRY, ap->a_td);
+ vn_lock(vp, LK_UPGRADE | LK_RETRY);
if (tvp == unp->un_uppervp)
unp->un_flag &= ~UNIONFS_OPENEXTU;
else
unp->un_flag &= ~UNIONFS_OPENEXTL;
- vn_lock(vp, LK_DOWNGRADE | LK_RETRY, ap->a_td);
+ vn_lock(vp, LK_DOWNGRADE | LK_RETRY);
}
return (error);
OpenPOWER on IntegriCloud