- Catch up with ufs_inode 1.59, ffs_vfsops.c 1.280, and ufs_vnops.c 1.267.

Various changes to support new vgone() locking protocol.

Sponsored by:	Isilon Systems, Inc.
This commit is contained in:
Jeff Roberson 2005-03-13 12:13:55 +00:00
parent 30144f05f0
commit d10f4f44f8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=143509
6 changed files with 16 additions and 72 deletions

View File

@ -499,7 +499,6 @@ ext2_inactive(ap)
}
}
out:
VOP_UNLOCK(vp, 0, td);
/*
* If we are done with the inode, reclaim it
* so that it can be reused immediately.

View File

@ -536,20 +536,13 @@ ext2_reload(struct mount *mp, struct thread *td)
MNT_ILOCK(mp);
MNT_VNODE_FOREACH(vp, mp, nvp) {
VI_LOCK(vp);
if (vp->v_iflag & VI_XLOCK) {
if (vp->v_iflag & VI_DOOMED) {
VI_UNLOCK(vp);
continue;
}
MNT_IUNLOCK(mp);
/*
* Step 4: invalidate all inactive vnodes.
*/
if (vp->v_usecount == 0) {
vgonel(vp, td);
goto loop;
}
/*
* Step 5: invalidate all cached file data.
* Step 4: invalidate all cached file data.
*/
if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, td)) {
goto loop;
@ -557,7 +550,7 @@ ext2_reload(struct mount *mp, struct thread *td)
if (vinvalbuf(vp, 0, td, 0, 0))
panic("ext2_reload: dirty2");
/*
* Step 6: re-read inode data for all active vnodes.
* Step 5: re-read inode data for all active vnodes.
*/
ip = VTOI(vp);
error =
@ -857,7 +850,7 @@ ext2_sync(mp, waitfor, td)
loop:
MNT_VNODE_FOREACH(vp, mp, nvp) {
VI_LOCK(vp);
if (vp->v_type == VNON || (vp->v_iflag & VI_XLOCK)) {
if (vp->v_type == VNON || (vp->v_iflag & VI_DOOMED)) {
VI_UNLOCK(vp);
continue;
}

View File

@ -277,31 +277,11 @@ ext2_close(ap)
} */ *ap;
{
struct vnode *vp = ap->a_vp;
struct mount *mp;
VI_LOCK(vp);
if (vp->v_usecount > 1) {
if (vp->v_usecount > 1)
ext2_itimes(vp);
VI_UNLOCK(vp);
} else {
VI_UNLOCK(vp);
/*
* If we are closing the last reference to an unlinked
* file, then it will be freed by the inactive routine.
* Because the freeing causes a the filesystem to be
* modified, it must be held up during periods when the
* filesystem is suspended.
*
* XXX - EAGAIN is returned to prevent vn_close from
* repeating the vrele operation.
*/
if (vp->v_type == VREG && VTOI(vp)->i_nlink == 0) {
(void) vn_start_write(vp, &mp, V_WAIT);
vrele(vp);
vn_finished_write(mp);
return (EAGAIN);
}
}
VI_UNLOCK(vp);
return (0);
}
@ -668,12 +648,12 @@ ext2_mknod(ap)
/*
* Remove inode, then reload it through VFS_VGET so it is
* checked to see if it is an alias of an existing entry in
* the inode cache.
* the inode cache. XXX I don't believe this is necessary now.
*/
vput(*vpp);
(*vpp)->v_type = VNON;
ino = ip->i_number; /* Save this before vgone() invalidates ip. */
vgone(*vpp);
vput(*vpp);
error = VFS_VGET(ap->a_dvp->v_mount, ino, LK_EXCLUSIVE, vpp);
if (error) {
*vpp = NULL;

View File

@ -499,7 +499,6 @@ ext2_inactive(ap)
}
}
out:
VOP_UNLOCK(vp, 0, td);
/*
* If we are done with the inode, reclaim it
* so that it can be reused immediately.

View File

@ -536,20 +536,13 @@ ext2_reload(struct mount *mp, struct thread *td)
MNT_ILOCK(mp);
MNT_VNODE_FOREACH(vp, mp, nvp) {
VI_LOCK(vp);
if (vp->v_iflag & VI_XLOCK) {
if (vp->v_iflag & VI_DOOMED) {
VI_UNLOCK(vp);
continue;
}
MNT_IUNLOCK(mp);
/*
* Step 4: invalidate all inactive vnodes.
*/
if (vp->v_usecount == 0) {
vgonel(vp, td);
goto loop;
}
/*
* Step 5: invalidate all cached file data.
* Step 4: invalidate all cached file data.
*/
if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, td)) {
goto loop;
@ -557,7 +550,7 @@ ext2_reload(struct mount *mp, struct thread *td)
if (vinvalbuf(vp, 0, td, 0, 0))
panic("ext2_reload: dirty2");
/*
* Step 6: re-read inode data for all active vnodes.
* Step 5: re-read inode data for all active vnodes.
*/
ip = VTOI(vp);
error =
@ -857,7 +850,7 @@ ext2_sync(mp, waitfor, td)
loop:
MNT_VNODE_FOREACH(vp, mp, nvp) {
VI_LOCK(vp);
if (vp->v_type == VNON || (vp->v_iflag & VI_XLOCK)) {
if (vp->v_type == VNON || (vp->v_iflag & VI_DOOMED)) {
VI_UNLOCK(vp);
continue;
}

View File

@ -277,31 +277,11 @@ ext2_close(ap)
} */ *ap;
{
struct vnode *vp = ap->a_vp;
struct mount *mp;
VI_LOCK(vp);
if (vp->v_usecount > 1) {
if (vp->v_usecount > 1)
ext2_itimes(vp);
VI_UNLOCK(vp);
} else {
VI_UNLOCK(vp);
/*
* If we are closing the last reference to an unlinked
* file, then it will be freed by the inactive routine.
* Because the freeing causes a the filesystem to be
* modified, it must be held up during periods when the
* filesystem is suspended.
*
* XXX - EAGAIN is returned to prevent vn_close from
* repeating the vrele operation.
*/
if (vp->v_type == VREG && VTOI(vp)->i_nlink == 0) {
(void) vn_start_write(vp, &mp, V_WAIT);
vrele(vp);
vn_finished_write(mp);
return (EAGAIN);
}
}
VI_UNLOCK(vp);
return (0);
}
@ -668,12 +648,12 @@ ext2_mknod(ap)
/*
* Remove inode, then reload it through VFS_VGET so it is
* checked to see if it is an alias of an existing entry in
* the inode cache.
* the inode cache. XXX I don't believe this is necessary now.
*/
vput(*vpp);
(*vpp)->v_type = VNON;
ino = ip->i_number; /* Save this before vgone() invalidates ip. */
vgone(*vpp);
vput(*vpp);
error = VFS_VGET(ap->a_dvp->v_mount, ino, LK_EXCLUSIVE, vpp);
if (error) {
*vpp = NULL;