summaryrefslogtreecommitdiffstats
path: root/sys/fs/hpfs/hpfs_vnops.c
diff options
context:
space:
mode:
authormckusick <mckusick@FreeBSD.org>2002-03-17 01:25:47 +0000
committermckusick <mckusick@FreeBSD.org>2002-03-17 01:25:47 +0000
commit14dd08fd153468502c32dc2d9c1e25a6c2d761d1 (patch)
treeee06559e7b5061e6fc6cf074dfca793dd31c681b /sys/fs/hpfs/hpfs_vnops.c
parent34dcf8975d103d034d7e8b6788c0645cc93af254 (diff)
downloadFreeBSD-src-14dd08fd153468502c32dc2d9c1e25a6c2d761d1.zip
FreeBSD-src-14dd08fd153468502c32dc2d9c1e25a6c2d761d1.tar.gz
Add a flags parameter to VFS_VGET to pass through the desired
locking flags when acquiring a vnode. The immediate purpose is to allow polling lock requests (LK_NOWAIT) needed by soft updates to avoid deadlock when enlisting other processes to help with the background cleanup. For the future it will allow the use of shared locks for read access to vnodes. This change touches a lot of files as it affects most filesystems within the system. It has been well tested on FFS, loopback, and CD-ROM filesystems. only lightly on the others, so if you find a problem there, please let me (mckusick@mckusick.com) know.
Diffstat (limited to 'sys/fs/hpfs/hpfs_vnops.c')
-rw-r--r--sys/fs/hpfs/hpfs_vnops.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/sys/fs/hpfs/hpfs_vnops.c b/sys/fs/hpfs/hpfs_vnops.c
index e3ed555..7b4d731 100644
--- a/sys/fs/hpfs/hpfs_vnops.c
+++ b/sys/fs/hpfs/hpfs_vnops.c
@@ -1096,21 +1096,18 @@ hpfs_lookup(ap)
dprintf(("hpfs_lookup(0x%x,...): .. faked (0x%x)\n",
dhp->h_no, dhp->h_fn.fn_parent));
- VOP_UNLOCK(dvp,0,cnp->cn_thread);
-
- error = VFS_VGET(hpmp->hpm_mp,
- dhp->h_fn.fn_parent, ap->a_vpp);
- if(error) {
+ if (VFS_VGET(hpmp->hpm_mp, dhp->h_fn.fn_parent,
+ LK_NOWAIT | LK_EXCLUSIVE, ap->a_vpp)) {
+ VOP_UNLOCK(dvp,0,cnp->cn_thread);
+ error = VFS_VGET(hpmp->hpm_mp,
+ dhp->h_fn.fn_parent, LK_EXCLUSIVE, ap->a_vpp);
VOP_LOCK(dvp, 0, cnp->cn_thread);
- return(error);
- }
-
- if( lockparent && (flags & ISLASTCN) &&
- (error = VOP_LOCK(dvp, 0, cnp->cn_thread)) ) {
- vput( *(ap->a_vpp) );
- return (error);
+ if(error)
+ return(error);
}
- return (error);
+ if (!lockparent || !(flags & ISLASTCN))
+ VOP_UNLOCK(dvp,0,cnp->cn_thread);
+ return (0);
} else {
struct buf *bp;
struct hpfsdirent *dep;
@@ -1148,7 +1145,8 @@ hpfs_lookup(ap)
return (0);
}
- error = VFS_VGET(hpmp->hpm_mp, dep->de_fnode, ap->a_vpp);
+ error = VFS_VGET(hpmp->hpm_mp, dep->de_fnode, LK_EXCLUSIVE,
+ ap->a_vpp);
if (error) {
printf("hpfs_lookup: VFS_VGET FAILED %d\n", error);
brelse(bp);
OpenPOWER on IntegriCloud