Fix for a Lock Order Reversal in the nfs_flush() path, between the

vnode interlock and the proc lock.

Reported by:	marcel
Submitted by:	Mohan Srinivasan mohans at yahoo-inc dot com
This commit is contained in:
Paul Saab 2004-12-07 21:16:32 +00:00
parent f30a4a1ced
commit 5e5f905de3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=138529

View File

@ -2820,10 +2820,6 @@ nfs_flush(struct vnode *vp, struct ucred *cred, int waitfor, struct thread *td,
s = splbio();
VI_LOCK(vp);
TAILQ_FOREACH_SAFE(bp, &vp->v_bufobj.bo_dirty.bv_hd, b_bobufs, nbp) {
if (nfs_sigintr(nmp, NULL, td)) {
error = EINTR;
goto done;
}
if (BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT, NULL)) {
if (waitfor != MNT_WAIT || passone)
continue;
@ -2836,6 +2832,10 @@ nfs_flush(struct vnode *vp, struct ucred *cred, int waitfor, struct thread *td,
panic("nfs_fsync: inconsistent lock");
if (error == ENOLCK)
goto loop;
if (nfs_sigintr(nmp, NULL, td)) {
error = EINTR;
goto done;
}
if (slpflag == PCATCH) {
slpflag = 0;
slptimeo = 2 * hz;
@ -2856,6 +2856,10 @@ nfs_flush(struct vnode *vp, struct ucred *cred, int waitfor, struct thread *td,
bp->b_flags |= B_ASYNC;
splx(s);
bwrite(bp);
if (nfs_sigintr(nmp, NULL, td)) {
error = EINTR;
goto done;
}
goto loop;
}
splx(s);