Fix a mntvnode and vnode interlock reversal.

This commit is contained in:
John Baldwin 2001-06-28 03:52:04 +00:00
parent 805d90f763
commit 797c3dba25
3 changed files with 12 additions and 9 deletions

View File

@ -866,18 +866,19 @@ msdosfs_sync(mp, waitfor, cred, p)
*/
if (vp->v_mount != mp)
goto loop;
mtx_lock(&vp->v_interlock);
nvp = LIST_NEXT(vp, v_mntvnodes);
mtx_unlock(&mntvnode_mtx);
mtx_lock(&vp->v_interlock);
dep = VTODE(vp);
if (vp->v_type == VNON ||
((dep->de_flag &
(DE_ACCESS | DE_CREATE | DE_UPDATE | DE_MODIFIED)) == 0 &&
(TAILQ_EMPTY(&vp->v_dirtyblkhd) || waitfor == MNT_LAZY))) {
mtx_unlock(&vp->v_interlock);
mtx_lock(&mntvnode_mtx);
continue;
}
mtx_unlock(&mntvnode_mtx);
error = vget(vp, LK_EXCLUSIVE | LK_NOWAIT | LK_INTERLOCK, p);
if (error) {
mtx_lock(&mntvnode_mtx);

View File

@ -582,8 +582,8 @@ ext2_reload(mountp, cred, p)
/*
* Step 5: invalidate all cached file data.
*/
mtx_lock(&vp->v_interlock);
mtx_unlock(&mntvnode_mtx);
mtx_lock(&vp->v_interlock);
if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, p)) {
goto loop;
}
@ -933,17 +933,18 @@ ext2_sync(mp, waitfor, cred, p)
*/
if (vp->v_mount != mp)
goto loop;
mtx_lock(&vp->v_interlock);
nvp = LIST_NEXT(vp, v_mntvnodes);
mtx_unlock(&mntvnode_mtx);
mtx_lock(&vp->v_interlock);
ip = VTOI(vp);
if (vp->v_type == VNON ||
((ip->i_flag &
(IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) == 0 &&
(TAILQ_EMPTY(&vp->v_dirtyblkhd) || waitfor == MNT_LAZY))) {
mtx_unlock(&vp->v_interlock);
mtx_lock(&mntvnode_mtx);
continue;
}
mtx_unlock(&mntvnode_mtx);
error = vget(vp, LK_EXCLUSIVE | LK_NOWAIT | LK_INTERLOCK, p);
if (error) {
mtx_lock(&mntvnode_mtx);

View File

@ -582,8 +582,8 @@ ext2_reload(mountp, cred, p)
/*
* Step 5: invalidate all cached file data.
*/
mtx_lock(&vp->v_interlock);
mtx_unlock(&mntvnode_mtx);
mtx_lock(&vp->v_interlock);
if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, p)) {
goto loop;
}
@ -933,17 +933,18 @@ ext2_sync(mp, waitfor, cred, p)
*/
if (vp->v_mount != mp)
goto loop;
mtx_lock(&vp->v_interlock);
nvp = LIST_NEXT(vp, v_mntvnodes);
mtx_unlock(&mntvnode_mtx);
mtx_lock(&vp->v_interlock);
ip = VTOI(vp);
if (vp->v_type == VNON ||
((ip->i_flag &
(IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) == 0 &&
(TAILQ_EMPTY(&vp->v_dirtyblkhd) || waitfor == MNT_LAZY))) {
mtx_unlock(&vp->v_interlock);
mtx_lock(&mntvnode_mtx);
continue;
}
mtx_unlock(&mntvnode_mtx);
error = vget(vp, LK_EXCLUSIVE | LK_NOWAIT | LK_INTERLOCK, p);
if (error) {
mtx_lock(&mntvnode_mtx);