summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2003-10-05 22:16:08 +0000
committerjeff <jeff@FreeBSD.org>2003-10-05 22:16:08 +0000
commit6be3f23255ffeca9ff53668b826e96d44b206a1f (patch)
treef185a3e10fbff38ee7ca3777298f603e9c98a85a /sys/kern
parent11b574e32bd87add2e3ae54eb59ff9f7bf1dabb6 (diff)
downloadFreeBSD-src-6be3f23255ffeca9ff53668b826e96d44b206a1f.zip
FreeBSD-src-6be3f23255ffeca9ff53668b826e96d44b206a1f.tar.gz
- 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.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/vfs_bio.c13
1 files changed, 9 insertions, 4 deletions
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);
}
OpenPOWER on IntegriCloud