summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2017-12-14 20:20:39 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2017-12-14 20:20:39 +0000
commit0d0ca081a91d670c354dd808865d61af95d43c04 (patch)
tree922d1b6127ef2fd18b4d4e3a5730fe5a7a6e458a
parent0bf7b44438def5f9a9675b4cc4ab0719c856973b (diff)
Give vflush_vnode() a hint about vnodes we don't need to account as "busy".
Change mountpoint to RDONLY a little later. Seems to improve the rw->ro transition a bit.
-rw-r--r--sys/kern/vfs_subr.c14
-rw-r--r--sys/sys/vnode.h4
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c7
3 files changed, 14 insertions, 11 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 088a8f883b7..da17524a115 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_subr.c,v 1.263 2017/12/11 14:11:22 bluhm Exp $ */
+/* $OpenBSD: vfs_subr.c,v 1.264 2017/12/14 20:20:38 deraadt Exp $ */
/* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */
/*
@@ -904,11 +904,15 @@ vflush_vnode(struct vnode *vp, void *arg)
return (0);
}
- if (va->flags & WRITEDEMOTE) {
- vp->v_op = &dead_vops;
- vp->v_tag = VT_NON;
+ /*
+ * If set, this is allowed to ignore vnodes which don't
+ * have changes pending to disk.
+ * XXX Might be nice to check per-fs "inode" flags, but
+ * generally the filesystem is sync'd already, right?
+ */
+ if ((va->flags & IGNORECLEAN) &&
+ LIST_EMPTY(&vp->v_dirtyblkhd))
return (0);
- }
#ifdef DEBUG
if (busyprt)
diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h
index 6578c6d54ff..32a2d96f71c 100644
--- a/sys/sys/vnode.h
+++ b/sys/sys/vnode.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vnode.h,v 1.141 2017/12/11 05:27:40 deraadt Exp $ */
+/* $OpenBSD: vnode.h,v 1.142 2017/12/14 20:20:38 deraadt Exp $ */
/* $NetBSD: vnode.h,v 1.38 1996/02/29 20:59:05 cgd Exp $ */
/*
@@ -227,7 +227,7 @@ extern int vttoif_tab[];
#define FORCECLOSE 0x0002 /* vflush: force file closeure */
#define WRITECLOSE 0x0004 /* vflush: only close writeable files */
#define DOCLOSE 0x0008 /* vclean: close active files */
-#define WRITEDEMOTE 0x0010 /* vflush: ok if some writes remain */
+#define IGNORECLEAN 0x0010 /* vflush: ignore clean vnodes */
#define V_SAVE 0x0001 /* vinvalbuf: sync file first */
#define V_SAVEMETA 0x0002 /* vinvalbuf: leave indirect blocks */
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index a04cda2e70f..64af433a272 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_vfsops.c,v 1.169 2017/12/14 17:25:39 guenther Exp $ */
+/* $OpenBSD: ffs_vfsops.c,v 1.170 2017/12/14 20:20:38 deraadt Exp $ */
/* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */
/*
@@ -243,16 +243,14 @@ ffs_mount(struct mount *mp, const char *path, void *data,
if (ronly == 0 && (mp->mnt_flag & MNT_RDONLY)) {
/* Flush any dirty data */
- mp->mnt_flag &= ~MNT_RDONLY;
VFS_SYNC(mp, MNT_WAIT, p->p_ucred, p);
- mp->mnt_flag |= MNT_RDONLY;
/*
* Get rid of files open for writing.
*/
flags = WRITECLOSE;
if (args == NULL)
- flags |= WRITEDEMOTE;
+ flags |= IGNORECLEAN;
if (mp->mnt_flag & MNT_FORCE)
flags |= FORCECLOSE;
if (fs->fs_flags & FS_DOSOFTDEP) {
@@ -260,6 +258,7 @@ ffs_mount(struct mount *mp, const char *path, void *data,
mp->mnt_flag &= ~MNT_SOFTDEP;
} else
error = ffs_flushfiles(mp, flags, p);
+ mp->mnt_flag |= MNT_RDONLY;
ronly = 1;
}