From f33f94c5aed09626c563e79cedcad69707872c24 Mon Sep 17 00:00:00 2001 From: sef Date: Tue, 9 Dec 1997 05:03:41 +0000 Subject: Code to prevent a panic caused by procfs_exit(). Note that i don't know what is teh root cause -- but, sometimes, a procfs vnode in pfshead is apparantly corrupt (or a UFS vnode instead). Without this patch, I can get it to panic by doing (in csh) while (1) ps auxwww end and it will panic when the PID's wrap. With it, it does not panic. Yes -- I know that this is NOT the right way to fix it. But I haven't been able to get it to panic yet (which confuses me). I am going to be looking into the vgone() code now, as that may be a part of it. --- sys/miscfs/procfs/procfs_subr.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'sys/miscfs/procfs/procfs_subr.c') diff --git a/sys/miscfs/procfs/procfs_subr.c b/sys/miscfs/procfs/procfs_subr.c index 12dcf76..e13e425 100644 --- a/sys/miscfs/procfs/procfs_subr.c +++ b/sys/miscfs/procfs/procfs_subr.c @@ -36,7 +36,7 @@ * * @(#)procfs_subr.c 8.6 (Berkeley) 5/14/95 * - * $Id: procfs_subr.c,v 1.18 1997/12/06 04:11:12 sef Exp $ + * $Id: procfs_subr.c,v 1.19 1997/12/08 01:06:22 sef Exp $ */ #include @@ -359,7 +359,15 @@ procfs_exit(struct proc *p) pid_t pid = p->p_pid; for (pfs = pfshead; pfs ; pfs = pfs->pfs_next) { - if (pfs->pfs_pid == pid) - vgone(PFSTOV(pfs)); + struct vnode *vp = PFSTOV(pfs); + /* + * XXX - this is probably over-paranoid here -- + * for some reason, occasionally the v_tag is + * not VT_PROCFS; this results in a panic. I'm + * not sure *why* that is happening. + */ + if (pfs->pfs_pid == pid && vp->v_usecount && + vp->v_tag == VT_PROCFS) + vgone(vp); } } -- cgit v1.1