Module Name:    src
Committed By:   hannken
Date:           Wed Jan 17 10:17:29 UTC 2024

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

Log Message:
Print dangling vnode before panic() to help debug.

PR kern/57775 ""panic: unmount: dangling vnode" while umounting procfs"


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 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.103 src/sys/kern/vfs_mount.c:1.104
--- src/sys/kern/vfs_mount.c:1.103	Thu Dec 28 12:48:08 2023
+++ src/sys/kern/vfs_mount.c	Wed Jan 17 10:17:29 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_mount.c,v 1.103 2023/12/28 12:48:08 hannken Exp $	*/
+/*	$NetBSD: vfs_mount.c,v 1.104 2024/01/17 10:17:29 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.103 2023/12/28 12:48:08 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.104 2024/01/17 10:17:29 hannken Exp $");
 
 #include "veriexec.h"
 
@@ -936,7 +936,7 @@ err_mounted:
 int
 dounmount(struct mount *mp, int flags, struct lwp *l)
 {
-	vnode_t *coveredvp;
+	vnode_t *coveredvp, *vp;
 	int error, async, used_syncer, used_extattr;
 	const bool was_suspended = fstrans_is_owner(mp);
 
@@ -1003,8 +1003,10 @@ dounmount(struct mount *mp, int flags, s
 		vfs_resume(mp);
 
 	mountlist_remove(mp);
-	if (TAILQ_FIRST(&mp->mnt_vnodelist) != NULL)
+	if ((vp = VIMPL_TO_VNODE(TAILQ_FIRST(&mp->mnt_vnodelist))) != NULL) {
+		vprint("dangling", vp);
 		panic("unmount: dangling vnode");
+	}
 	vfs_hooks_unmount(mp);
 
 	vfs_set_lowermount(mp, NULL);

Reply via email to