Take care not to call vput if thread used in corresponding vget

wasn't curthread, i.e. when we receive a thread pointer to use
as a function argument. Use VOP_UNLOCK/vrele in these cases.

The only case there td != curthread known at the moment is
boot() calling sync with thread0 pointer.

This fixes the panic on shutdown people have reported.
This commit is contained in:
Alexander Kabaev 2003-11-02 04:52:53 +00:00
parent 769a363537
commit cb9ddc80ae
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=121874
7 changed files with 20 additions and 10 deletions

View File

@ -814,7 +814,8 @@ msdosfs_sync(mp, waitfor, cred, td)
error = VOP_FSYNC(vp, cred, waitfor, td);
if (error)
allerror = error;
vput(vp);
VOP_UNLOCK(vp, 0, td);
vrele(vp);
mtx_lock(&mntvnode_mtx);
}
mtx_unlock(&mntvnode_mtx);

View File

@ -933,7 +933,8 @@ ext2_sync(mp, waitfor, cred, td)
}
if ((error = VOP_FSYNC(vp, cred, waitfor, td)) != 0)
allerror = error;
vput(vp);
VOP_UNLOCK(vp, 0, td);
vrele(vp);
mtx_lock(&mntvnode_mtx);
}
mtx_unlock(&mntvnode_mtx);

View File

@ -933,7 +933,8 @@ ext2_sync(mp, waitfor, cred, td)
}
if ((error = VOP_FSYNC(vp, cred, waitfor, td)) != 0)
allerror = error;
vput(vp);
VOP_UNLOCK(vp, 0, td);
vrele(vp);
mtx_lock(&mntvnode_mtx);
}
mtx_unlock(&mntvnode_mtx);

View File

@ -908,7 +908,8 @@ vfs_stdsync(mp, waitfor, cred, td)
if (error)
allerror = error;
vput(vp);
VOP_UNLOCK(vp, 0, td);
vrele(vp);
mtx_lock(&mntvnode_mtx);
}
mtx_unlock(&mntvnode_mtx);

View File

@ -958,7 +958,8 @@ nfs_sync(struct mount *mp, int waitfor, struct ucred *cred, struct thread *td)
error = VOP_FSYNC(vp, cred, waitfor, td);
if (error)
allerror = error;
vput(vp);
VOP_UNLOCK(vp, 0, td);
vrele(vp);
mtx_lock(&mntvnode_mtx);
}
mtx_unlock(&mntvnode_mtx);

View File

@ -537,7 +537,8 @@ ffs_reload(mp, cred, td)
ffs_load_inode(bp, ip, fs, ip->i_number);
ip->i_effnlink = ip->i_nlink;
brelse(bp);
vput(vp);
VOP_UNLOCK(vp, 0, td);
vrele(vp);
mtx_lock(&mntvnode_mtx);
}
mtx_unlock(&mntvnode_mtx);
@ -1166,7 +1167,8 @@ ffs_sync(mp, waitfor, cred, td)
}
if ((error = VOP_FSYNC(vp, cred, waitfor, td)) != 0)
allerror = error;
vput(vp);
VOP_UNLOCK(vp, 0, td);
vrele(vp);
mtx_lock(&mntvnode_mtx);
if (TAILQ_NEXT(vp, v_nmntvnodes) != nvp)
goto loop;

View File

@ -468,12 +468,14 @@ quotaon(td, mp, type, fname)
goto again;
}
if (vp->v_type == VNON || vp->v_writecount == 0) {
vput(vp);
VOP_UNLOCK(vp, 0, td);
vrele(vp);
mtx_lock(&mntvnode_mtx);
continue;
}
error = getinoquota(VTOI(vp));
vput(vp);
VOP_UNLOCK(vp, 0, td);
vrele(vp);
mtx_lock(&mntvnode_mtx);
if (error)
break;
@ -536,7 +538,8 @@ quotaoff(td, mp, type)
dq = ip->i_dquot[type];
ip->i_dquot[type] = NODQUOT;
dqrele(vp, dq);
vput(vp);
VOP_UNLOCK(vp, 0, td);
vrele(vp);
mtx_lock(&mntvnode_mtx);
if (TAILQ_NEXT(vp, v_nmntvnodes) != nextvp)
goto again;