Module Name:    src
Committed By:   hannken
Date:           Mon Aug 22 09:14:24 UTC 2022

Modified Files:
        src/sys/kern: vfs_mount.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/kern/vfs_mount.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/vfs_mount.c
diff -u src/sys/kern/vfs_mount.c:1.94 src/sys/kern/vfs_mount.c:1.95
--- src/sys/kern/vfs_mount.c:1.94	Fri Jul  8 07:43:19 2022
+++ src/sys/kern/vfs_mount.c	Mon Aug 22 09:14:24 2022
@@ -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 @@ dounmount(struct mount *mp, int flags, s
 	 * vfs_busy() from succeeding.
 	 */
 	mp->mnt_iflag |= IMNT_GONE;
-	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);
 	}
+	if (!was_suspended)
+		vfs_resume(mp);
+
 	mountlist_remove(mp);
 	if (TAILQ_FIRST(&mp->mnt_vnodelist) != NULL)
 		panic("unmount: dangling vnode");

Reply via email to