Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Protect changing "v_mountedhere" with file system s...



details:   https://anonhg.NetBSD.org/src/rev/f5b92c8829ed
branches:  trunk
changeset: 369582:f5b92c8829ed
user:      hannken <hannken%NetBSD.org@localhost>
date:      Mon Aug 22 09:14:24 2022 +0000

description:
Protect changing "v_mountedhere" with file system suspension instead
of vnode lock.

diffstat:

 sys/kern/vfs_mount.c |  12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diffs (36 lines):

diff -r 29336beeaca8 -r f5b92c8829ed sys/kern/vfs_mount.c
--- a/sys/kern/vfs_mount.c      Mon Aug 22 09:13:08 2022 +0000
+++ b/sys/kern/vfs_mount.c      Mon Aug 22 09:14:24 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_mount.c,v 1.94 2022/07/08 07:43:19 hannken Exp $   */
+/*     $NetBSD: vfs_mount.c,v 1.95 2022/08/22 09:14:24 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.94 2022/07/08 07:43:19 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.95 2022/08/22 09:14:24 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -929,14 +929,12 @@
         * vfs_busy() from succeeding.
         */
        mp->mnt_iflag |= IMNT_GONE;
+       if ((coveredvp = mp->mnt_vnodecovered) != NULLVP) {
+               coveredvp->v_mountedhere = NULL;
+       }
        if (!was_suspended)
                vfs_resume(mp);
 
-       if ((coveredvp = mp->mnt_vnodecovered) != NULLVP) {
-               vn_lock(coveredvp, LK_EXCLUSIVE | LK_RETRY);
-               coveredvp->v_mountedhere = NULL;
-               VOP_UNLOCK(coveredvp);
-       }
        mountlist_remove(mp);
        if (TAILQ_FIRST(&mp->mnt_vnodelist) != NULL)
                panic("unmount: dangling vnode");



Home | Main Index | Thread Index | Old Index