summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_subr.c
diff options
context:
space:
mode:
authorcsapuntz <csapuntz@openbsd.org>1998-11-12 04:30:01 +0000
committercsapuntz <csapuntz@openbsd.org>1998-11-12 04:30:01 +0000
commit313df5db05c2816eef6468506a83d99bee97a20d (patch)
tree2a3697e7eb8246ed71155ccef88ab2f873b23741 /sys/kern/vfs_subr.c
parentMerge with FreeBSD: (diff)
downloadwireguard-openbsd-313df5db05c2816eef6468506a83d99bee97a20d.tar.xz
wireguard-openbsd-313df5db05c2816eef6468506a83d99bee97a20d.zip
Integrate latest soft updates patches for McKusick.
Integrate cleaner ffs mount code from FreeBSD. Most notably, this mount code prevents you from mounting an unclean file system read-write.
Diffstat (limited to 'sys/kern/vfs_subr.c')
-rw-r--r--sys/kern/vfs_subr.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index dc87e22f497..f639aba92f9 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_subr.c,v 1.23 1998/10/13 16:42:01 csapuntz Exp $ */
+/* $OpenBSD: vfs_subr.c,v 1.24 1998/11/12 04:30:02 csapuntz Exp $ */
/* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */
/*
@@ -1838,11 +1838,22 @@ vinvalbuf(vp, flags, cred, p, slpflag, slptimeo)
struct buf *nbp, *blist;
int s, error;
- if ((flags & V_SAVE) && vp->v_dirtyblkhd.lh_first != NULL) {
- if ((error = VOP_FSYNC(vp, cred, MNT_WAIT, p)) != 0)
- return (error);
- if (vp->v_dirtyblkhd.lh_first != NULL)
- panic("vinvalbuf: dirty bufs");
+ if (flags & V_SAVE) {
+ s = splbio();
+ while (vp->v_numoutput) {
+ vp->v_flag |= VBWAIT;
+ sleep((caddr_t)&vp->v_numoutput, PRIBIO + 1);
+ }
+ if (vp->v_dirtyblkhd.lh_first != NULL) {
+ splx(s);
+ if ((error = VOP_FSYNC(vp, cred, MNT_WAIT, p)) != 0)
+ return (error);
+ s = splbio();
+ if (vp->v_numoutput > 0 ||
+ vp->v_dirtyblkhd.lh_first != NULL)
+ panic("vinvalbuf: dirty bufs");
+ }
+ splx(s);
}
for (;;) {
if ((blist = vp->v_cleanblkhd.lh_first) &&