diff options
author | Kirk McKusick <mckusick@FreeBSD.org> | 2002-03-17 01:25:47 +0000 |
---|---|---|
committer | Kirk McKusick <mckusick@FreeBSD.org> | 2002-03-17 01:25:47 +0000 |
commit | a0595d02498c3bbf346523af18a2f91f3719aa89 (patch) | |
tree | ee06559e7b5061e6fc6cf074dfca793dd31c681b /sys/gnu/fs/ext2fs | |
parent | ac59490b5e8758c488d019b598eea3974cbd5885 (diff) | |
download | src-a0595d02498c3bbf346523af18a2f91f3719aa89.tar.gz src-a0595d02498c3bbf346523af18a2f91f3719aa89.zip |
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.
Notes
Notes:
svn path=/head/; revision=92462
Diffstat (limited to 'sys/gnu/fs/ext2fs')
-rw-r--r-- | sys/gnu/fs/ext2fs/ext2_alloc.c | 2 | ||||
-rw-r--r-- | sys/gnu/fs/ext2fs/ext2_lookup.c | 15 | ||||
-rw-r--r-- | sys/gnu/fs/ext2fs/ext2_vfsops.c | 9 | ||||
-rw-r--r-- | sys/gnu/fs/ext2fs/ext2_vnops.c | 2 |
4 files changed, 18 insertions, 10 deletions
diff --git a/sys/gnu/fs/ext2fs/ext2_alloc.c b/sys/gnu/fs/ext2fs/ext2_alloc.c index 5b04196a5e0a..f078e04e1309 100644 --- a/sys/gnu/fs/ext2fs/ext2_alloc.c +++ b/sys/gnu/fs/ext2fs/ext2_alloc.c @@ -399,7 +399,7 @@ ext2_valloc(pvp, mode, cred, vpp) if (ino == 0) goto noinodes; - error = VFS_VGET(pvp->v_mount, ino, vpp); + error = VFS_VGET(pvp->v_mount, ino, LK_EXCLUSIVE, vpp); if (error) { UFS_VFREE(pvp, ino, mode); return (error); diff --git a/sys/gnu/fs/ext2fs/ext2_lookup.c b/sys/gnu/fs/ext2fs/ext2_lookup.c index b2e15114721b..50479e02b668 100644 --- a/sys/gnu/fs/ext2fs/ext2_lookup.c +++ b/sys/gnu/fs/ext2fs/ext2_lookup.c @@ -601,7 +601,8 @@ found: *vpp = vdp; return (0); } - if ((error = VFS_VGET(vdp->v_mount, dp->i_ino, &tdp)) != 0) + if ((error = VFS_VGET(vdp->v_mount, dp->i_ino, LK_EXCLUSIVE, + &tdp)) != 0) return (error); /* * If directory is "sticky", then user must own @@ -638,7 +639,8 @@ found: */ if (dp->i_number == dp->i_ino) return (EISDIR); - if ((error = VFS_VGET(vdp->v_mount, dp->i_ino, &tdp)) != 0) + if ((error = VFS_VGET(vdp->v_mount, dp->i_ino, LK_EXCLUSIVE, + &tdp)) != 0) return (error); *vpp = tdp; cnp->cn_flags |= SAVENAME; @@ -669,7 +671,8 @@ found: pdp = vdp; if (flags & ISDOTDOT) { VOP_UNLOCK(pdp, 0, td); /* race to get the inode */ - if ((error = VFS_VGET(vdp->v_mount, dp->i_ino, &tdp)) != 0) { + if ((error = VFS_VGET(vdp->v_mount, dp->i_ino, LK_EXCLUSIVE, + &tdp)) != 0) { vn_lock(pdp, LK_EXCLUSIVE | LK_RETRY, td); return (error); } @@ -683,7 +686,8 @@ found: VREF(vdp); /* we want ourself, ie "." */ *vpp = vdp; } else { - if ((error = VFS_VGET(vdp->v_mount, dp->i_ino, &tdp)) != 0) + if ((error = VFS_VGET(vdp->v_mount, dp->i_ino, LK_EXCLUSIVE, + &tdp)) != 0) return (error); if (!lockparent || !(flags & ISLASTCN)) VOP_UNLOCK(pdp, 0, td); @@ -1064,7 +1068,8 @@ ext2_checkpath(source, target, cred) if (dirbuf.dotdot_ino == rootino) break; vput(vp); - if ((error = VFS_VGET(vp->v_mount, dirbuf.dotdot_ino, &vp)) != 0) { + if ((error = VFS_VGET(vp->v_mount, dirbuf.dotdot_ino, + LK_EXCLUSIVE, &vp)) != 0) { vp = NULL; break; } diff --git a/sys/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c index 15a94d998182..8a7cc07cf975 100644 --- a/sys/gnu/fs/ext2fs/ext2_vfsops.c +++ b/sys/gnu/fs/ext2fs/ext2_vfsops.c @@ -80,7 +80,7 @@ static int ext2_sbupdate __P((struct ufsmount *, int)); static int ext2_statfs __P((struct mount *, struct statfs *, struct thread *)); static int ext2_sync __P((struct mount *, int, struct ucred *, struct thread *)); static int ext2_unmount __P((struct mount *, int, struct thread *)); -static int ext2_vget __P((struct mount *, ino_t, struct vnode **)); +static int ext2_vget __P((struct mount *, ino_t, int, struct vnode **)); static int ext2_vptofh __P((struct vnode *, struct fid *)); static MALLOC_DEFINE(M_EXT2NODE, "EXT2 node", "EXT2 vnode private part"); @@ -982,9 +982,10 @@ loop: * done by the calling routine. */ static int -ext2_vget(mp, ino, vpp) +ext2_vget(mp, ino, flags, vpp) struct mount *mp; ino_t ino; + int flags; struct vnode **vpp; { register struct ext2_sb_info *fs; @@ -999,7 +1000,9 @@ ext2_vget(mp, ino, vpp) ump = VFSTOUFS(mp); dev = ump->um_dev; restart: - if ((*vpp = ufs_ihashget(dev, ino)) != NULL) + if ((error = ufs_ihashget(dev, ino, flags, vpp)) != 0) + return (error); + if (*vpp != NULL) return (0); /* diff --git a/sys/gnu/fs/ext2fs/ext2_vnops.c b/sys/gnu/fs/ext2fs/ext2_vnops.c index ad607280b635..a90c20f2bedb 100644 --- a/sys/gnu/fs/ext2fs/ext2_vnops.c +++ b/sys/gnu/fs/ext2fs/ext2_vnops.c @@ -285,7 +285,7 @@ ext2_mknod(ap) (*vpp)->v_type = VNON; ino = ip->i_number; /* Save this before vgone() invalidates ip. */ vgone(*vpp); - error = VFS_VGET(ap->a_dvp->v_mount, ino, vpp); + error = VFS_VGET(ap->a_dvp->v_mount, ino, LK_EXCLUSIVE, vpp); if (error) { *vpp = NULL; return (error); |