Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Destroy anonymous device vnodes on reboot once the ...
details: https://anonhg.NetBSD.org/src/rev/dff5124a035b
branches: trunk
changeset: 971245:dff5124a035b
user: hannken <hannken%NetBSD.org@localhost>
date: Sun Apr 19 13:26:17 2020 +0000
description:
Destroy anonymous device vnodes on reboot once the last file system
got unmounted and the mount list is empty.
PR kern/54969: Disk cache is no longer flushed on shutdown
diffstat:
sys/kern/vfs_mount.c | 25 +++++++++++++++++++++++--
1 files changed, 23 insertions(+), 2 deletions(-)
diffs (60 lines):
diff -r 8d3d9e588852 -r dff5124a035b sys/kern/vfs_mount.c
--- a/sys/kern/vfs_mount.c Sun Apr 19 13:25:00 2020 +0000
+++ b/sys/kern/vfs_mount.c Sun Apr 19 13:26:17 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_mount.c,v 1.78 2020/04/13 19:23:18 ad Exp $ */
+/* $NetBSD: vfs_mount.c,v 1.79 2020/04/19 13:26:17 hannken Exp $ */
/*-
* Copyright (c) 1997-2020 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.78 2020/04/13 19:23:18 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.79 2020/04/19 13:26:17 hannken Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -115,6 +115,8 @@
/* Root filesystem. */
vnode_t * rootvnode;
+extern struct mount *dead_rootmount;
+
/* Mounted filesystem list. */
static TAILQ_HEAD(mountlist, mountlist_entry) mountlist;
static kmutex_t mountlist_lock __cacheline_aligned;
@@ -1020,6 +1022,7 @@
vfs_unmountall1(struct lwp *l, bool force, bool verbose)
{
struct mount *mp;
+ mount_iterator_t *iter;
bool any_error = false, progress = false;
uint64_t gen;
int error;
@@ -1054,6 +1057,24 @@
if (any_error && verbose) {
printf("WARNING: some file systems would not unmount\n");
}
+
+ /* If the mountlist is empty destroy anonymous device vnodes. */
+ mountlist_iterator_init(&iter);
+ if (mountlist_iterator_next(iter) == NULL) {
+ struct vnode_iterator *marker;
+ vnode_t *vp;
+
+ vfs_vnode_iterator_init(dead_rootmount, &marker);
+ while ((vp = vfs_vnode_iterator_next(marker, NULL, NULL))) {
+ if (vp->v_type == VCHR || vp->v_type == VBLK)
+ vgone(vp);
+ else
+ vrele(vp);
+ }
+ vfs_vnode_iterator_destroy(marker);
+ }
+ mountlist_iterator_destroy(iter);
+
return progress;
}
Home |
Main Index |
Thread Index |
Old Index