Source-Changes-HG archive

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

[src/trunk]: src/sys Handle IMNT_GONE on the file system we want suspended no...



details:   https://anonhg.NetBSD.org/src/rev/f0766a92e926
branches:  trunk
changeset: 368375:f0766a92e926
user:      hannken <hannken%NetBSD.org@localhost>
date:      Fri Jul 08 07:42:05 2022 +0000

description:
Handle IMNT_GONE on the file system we want suspended not its
lowest mount we really suspend.

diffstat:

 sys/kern/vfs_trans.c            |  16 +++++++++++-----
 sys/miscfs/genfs/genfs_vfsops.c |  17 ++++-------------
 2 files changed, 15 insertions(+), 18 deletions(-)

diffs (94 lines):

diff -r 82044d474572 -r f0766a92e926 sys/kern/vfs_trans.c
--- a/sys/kern/vfs_trans.c      Fri Jul 08 07:02:47 2022 +0000
+++ b/sys/kern/vfs_trans.c      Fri Jul 08 07:42:05 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_trans.c,v 1.64 2022/06/28 00:13:48 riastradh Exp $ */
+/*     $NetBSD: vfs_trans.c,v 1.65 2022/07/08 07:42:05 hannken Exp $   */
 
 /*-
  * Copyright (c) 2007, 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.64 2022/06/28 00:13:48 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.65 2022/07/08 07:42:05 hannken Exp $");
 
 /*
  * File system transaction operations.
@@ -748,7 +748,6 @@
                return EOPNOTSUPP;
 
        fli = fstrans_get_lwp_info(mp, true);
-       mp = fli->fli_mount;
 
        if (nowait) {
                if (!mutex_tryenter(&vfs_suspend_lock))
@@ -756,10 +755,17 @@
        } else
                mutex_enter(&vfs_suspend_lock);
 
-       if ((error = VFS_SUSPENDCTL(mp, SUSPEND_SUSPEND)) != 0)
+       if ((error = VFS_SUSPENDCTL(fli->fli_mount, SUSPEND_SUSPEND)) != 0) {
                mutex_exit(&vfs_suspend_lock);
+               return error;
+       }
 
-       return error;
+       if ((mp->mnt_iflag & IMNT_GONE) != 0) {
+               vfs_resume(mp);
+               return ENOENT;
+       }
+
+       return 0;
 }
 
 /*
diff -r 82044d474572 -r f0766a92e926 sys/miscfs/genfs/genfs_vfsops.c
--- a/sys/miscfs/genfs/genfs_vfsops.c   Fri Jul 08 07:02:47 2022 +0000
+++ b/sys/miscfs/genfs/genfs_vfsops.c   Fri Jul 08 07:42:05 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: genfs_vfsops.c,v 1.10 2019/12/22 19:47:34 ad Exp $     */
+/*     $NetBSD: genfs_vfsops.c,v 1.11 2022/07/08 07:42:06 hannken Exp $        */
 
 /*-
  * Copyright (c) 2008, 2009, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfs_vfsops.c,v 1.10 2019/12/22 19:47:34 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_vfsops.c,v 1.11 2022/07/08 07:42:06 hannken Exp $");
 
 #include <sys/types.h>
 #include <sys/mount.h>
@@ -76,7 +76,6 @@
 genfs_suspendctl(struct mount *mp, int cmd)
 {
        int error;
-       int error2 __diagused;
 
        switch (cmd) {
        case SUSPEND_SUSPEND:
@@ -84,19 +83,11 @@
                if (error)
                        return error;
                error = fstrans_setstate(mp, FSTRANS_SUSPENDED);
-               if (error == 0) {
-                       if ((mp->mnt_iflag & IMNT_GONE) != 0)
-                               error = ENOENT;
-                       if (error) {
-                               error2 = fstrans_setstate(mp, FSTRANS_NORMAL);
-                               KASSERT(error2 == 0);
-                       }
-               }
                return error;
 
        case SUSPEND_RESUME:
-               error2 = fstrans_setstate(mp, FSTRANS_NORMAL);
-               KASSERT(error2 == 0);
+               error = fstrans_setstate(mp, FSTRANS_NORMAL);
+               KASSERT(error == 0);
                return 0;
 
        default:



Home | Main Index | Thread Index | Old Index