diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2006-08-17 13:55:58 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2006-08-17 13:55:58 +0000 |
commit | 8425b5664cf8782fc176790391a625c1f7733e92 (patch) | |
tree | ee878292bff6a0858d934805e8352d5bc5e03fb6 /sys/kern/vfs_bio.c | |
parent | 57c490eb019f1d1d8a691a64bcf235606517d662 (diff) |
chose proper mountpoint in making decision on upgrading
bwrte() to async op. this fixes in particular panics w/
softdep ffs mounted at a dir in an async mounted (mfs)
file system and also a few other evil scenarios.
this also matches a netbsd change 1.76 .
tested by many on many archs; pedro@ ok
Diffstat (limited to 'sys/kern/vfs_bio.c')
-rw-r--r-- | sys/kern/vfs_bio.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 466a7439583..d089f681aa3 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_bio.c,v 1.81 2006/08/09 12:00:03 pedro Exp $ */ +/* $OpenBSD: vfs_bio.c,v 1.82 2006/08/17 13:55:57 mickey Exp $ */ /* $NetBSD: vfs_bio.c,v 1.44 1996/06/11 11:15:36 pk Exp $ */ /*- @@ -312,6 +312,12 @@ bwrite(struct buf *bp) struct vnode *vp; struct mount *mp; + vp = bp->b_vp; + if (vp != NULL) + mp = vp->v_type == VBLK? vp->v_specmountpoint : vp->v_mount; + else + mp = NULL; + /* * Remember buffer type, to switch on it later. If the write was * synchronous, but the file system was mounted with MNT_ASYNC, @@ -320,8 +326,7 @@ bwrite(struct buf *bp) * to async, not sync writes (which is safe, but ugly). */ async = ISSET(bp->b_flags, B_ASYNC); - if (!async && bp->b_vp && bp->b_vp->v_mount && - ISSET(bp->b_vp->v_mount->mnt_flag, MNT_ASYNC)) { + if (!async && mp && ISSET(mp->mnt_flag, MNT_ASYNC)) { bdwrite(bp); return (0); } @@ -331,17 +336,11 @@ bwrite(struct buf *bp) * Writes to block devices are charged to their associated * filesystem (if any). */ - if ((vp = bp->b_vp) != NULL) { - if (vp->v_type == VBLK) - mp = vp->v_specmountpoint; + if (mp != NULL) { + if (async) + mp->mnt_stat.f_asyncwrites++; else - mp = vp->v_mount; - if (mp != NULL) { - if (async) - mp->mnt_stat.f_asyncwrites++; - else - mp->mnt_stat.f_syncwrites++; - } + mp->mnt_stat.f_syncwrites++; } wasdelayed = ISSET(bp->b_flags, B_DELWRI); |