From 6be3f23255ffeca9ff53668b826e96d44b206a1f Mon Sep 17 00:00:00 2001 From: jeff Date: Sun, 5 Oct 2003 22:16:08 +0000 Subject: - Add a missing vn_start_write() to flushbufqueues(). This could have caused snapshot related problems. - The vp can not be NULL here or we would panic in vfs_bio_awrite(). Stop confusing the logic by checking for it in several places. Submitted by: kirk and then rototilled by me to remove vp == NULL checks. --- sys/kern/vfs_bio.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'sys/kern/vfs_bio.c') diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index e9d8858..628938a 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -2135,6 +2135,7 @@ flushbufqueues(int flushdeps) { struct thread *td = curthread; struct vnode *vp; + struct mount *mp; struct buf *bp; int hasdeps; @@ -2176,12 +2177,16 @@ flushbufqueues(int flushdeps) * of vnode followed by buf lock. This is ok because * the NOWAIT will prevent deadlock. */ - if ((vp = bp->b_vp) == NULL || - vn_lock(vp, LK_EXCLUSIVE | LK_NOWAIT, td) == 0) { + vp = bp->b_vp; + if (vn_start_write(vp, &mp, V_NOWAIT) != 0) { + BUF_UNLOCK(bp); + continue; + } + if (vn_lock(vp, LK_EXCLUSIVE | LK_NOWAIT, td) == 0) { mtx_unlock(&bqlock); vfs_bio_awrite(bp); - if (vp != NULL) - VOP_UNLOCK(vp, 0, td); + vn_finished_write(mp); + VOP_UNLOCK(vp, 0, td); flushwithdeps += hasdeps; return (1); } -- cgit v1.1