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.
This commit is contained in:
Sean Eric Fagan 1997-12-09 05:03:41 +00:00
parent eae8fc2c8a
commit 7486d3658f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=31640
2 changed files with 22 additions and 6 deletions

View File

@ -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 <sys/param.h>
@ -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);
}
}

View File

@ -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 <sys/param.h>
@ -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);
}
}