Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Always use the lowest mount for fstrans and suspend...



details:   https://anonhg.NetBSD.org/src/rev/f1fa56fc2ac2
branches:  trunk
changeset: 822187:f1fa56fc2ac2
user:      hannken <hannken%NetBSD.org@localhost>
date:      Mon Mar 06 10:11:21 2017 +0000

description:
Always use the lowest mount for fstrans and suspend.  This way we
enter/leave or suspend/resume the stack of layered file systems as a unit.

diffstat:

 sys/kern/vfs_mount.c |  16 ++++++++--------
 sys/kern/vfs_trans.c |   6 ++++--
 2 files changed, 12 insertions(+), 10 deletions(-)

diffs (71 lines):

diff -r 18882965de97 -r f1fa56fc2ac2 sys/kern/vfs_mount.c
--- a/sys/kern/vfs_mount.c      Mon Mar 06 10:10:43 2017 +0000
+++ b/sys/kern/vfs_mount.c      Mon Mar 06 10:11:21 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_mount.c,v 1.49 2017/03/06 10:10:43 hannken Exp $   */
+/*     $NetBSD: vfs_mount.c,v 1.50 2017/03/06 10:11:21 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.49 2017/03/06 10:10:43 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.50 2017/03/06 10:11:21 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -711,12 +711,6 @@
                return ENOMEM;
        }
 
-       if ((error = fstrans_mount(mp)) != 0) {
-               vfs_unbusy(mp, false, NULL);
-               vfs_destroy(mp);
-               return error;
-       }
-
        mp->mnt_stat.f_owner = kauth_cred_geteuid(l->l_cred);
 
        /*
@@ -734,6 +728,12 @@
        if (error != 0)
                goto err_unmounted;
 
+       if (mp->mnt_lower == NULL) {
+               error = fstrans_mount(mp);
+               if (error)
+                       goto err_mounted;
+       }
+
        /*
         * Validate and prepare the mount point.
         */
diff -r 18882965de97 -r f1fa56fc2ac2 sys/kern/vfs_trans.c
--- a/sys/kern/vfs_trans.c      Mon Mar 06 10:10:43 2017 +0000
+++ b/sys/kern/vfs_trans.c      Mon Mar 06 10:11:21 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_trans.c,v 1.38 2017/03/02 10:41:27 hannken Exp $   */
+/*     $NetBSD: vfs_trans.c,v 1.39 2017/03/06 10:11:21 hannken Exp $   */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.38 2017/03/02 10:41:27 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.39 2017/03/06 10:11:21 hannken Exp $");
 
 /*
  * File system transaction operations.
@@ -123,6 +123,8 @@
 fstrans_normalize_mount(struct mount *mp)
 {
 
+       while (mp && mp->mnt_lower)
+               mp = mp->mnt_lower;
        if (mp == NULL)
                return NULL;
        if ((mp->mnt_iflag & IMNT_HAS_TRANS) == 0)



Home | Main Index | Thread Index | Old Index