From ca4932dc6d190e8b48a11b715b50a9a4745b52d7 Mon Sep 17 00:00:00 2001 From: hannken Date: Wed, 17 Jan 2024 10:17:29 +0000 Subject: [PATCH] Print dangling vnode before panic() to help debug. PR kern/57775 ""panic: unmount: dangling vnode" while umounting procfs" --- sys/kern/vfs_mount.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 4fe60f4fe2a0..3d4f76b65f22 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -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 -__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, struct lwp *l) 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);