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/18882965de97
branches:  trunk
changeset: 822186:18882965de97
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 3fb948f54aab -r 18882965de97 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