Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Deny unmounting file systems below layered file sys...
details: https://anonhg.NetBSD.org/src/rev/a410697bbc8c
branches: trunk
changeset: 351935:a410697bbc8c
user: hannken <hannken%NetBSD.org@localhost>
date: Mon Mar 06 10:10:43 2017 +0000
description:
Deny unmounting file systems below layered file systems.
diffstat:
sys/kern/vfs_mount.c | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
diffs (45 lines):
diff -r 5661a0c72e40 -r a410697bbc8c sys/kern/vfs_mount.c
--- a/sys/kern/vfs_mount.c Mon Mar 06 10:10:07 2017 +0000
+++ b/sys/kern/vfs_mount.c Mon Mar 06 10:10:43 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_mount.c,v 1.48 2017/02/22 09:50:13 hannken Exp $ */
+/* $NetBSD: vfs_mount.c,v 1.49 2017/03/06 10:10:43 hannken Exp $ */
/*-
* Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.48 2017/02/22 09:50:13 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.49 2017/03/06 10:10:43 hannken Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -817,6 +817,7 @@
int
dounmount(struct mount *mp, int flags, struct lwp *l)
{
+ struct mount *cmp;
vnode_t *coveredvp;
int error, async, used_syncer, used_extattr;
@@ -827,6 +828,18 @@
#endif /* NVERIEXEC > 0 */
/*
+ * No unmount below layered mounts.
+ */
+ mutex_enter(&mountlist_lock);
+ TAILQ_FOREACH(cmp, &mountlist, mnt_list) {
+ if (cmp->mnt_lower == mp) {
+ mutex_exit(&mountlist_lock);
+ return EBUSY;
+ }
+ }
+ mutex_exit(&mountlist_lock);
+
+ /*
* XXX Freeze syncer. Must do this before locking the
* mount point. See dounmount() for details.
*/
Home |
Main Index |
Thread Index |
Old Index