summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsef <sef@FreeBSD.org>1997-12-09 05:03:41 +0000
committersef <sef@FreeBSD.org>1997-12-09 05:03:41 +0000
commitf33f94c5aed09626c563e79cedcad69707872c24 (patch)
tree14313d0c07d581a7a4492c0087b9236882ae2ad8
parent6dd7dcc53b675eb0167c348bd2a4b6f527ec387c (diff)
downloadFreeBSD-src-f33f94c5aed09626c563e79cedcad69707872c24.zip
FreeBSD-src-f33f94c5aed09626c563e79cedcad69707872c24.tar.gz
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.
-rw-r--r--sys/fs/procfs/procfs_subr.c14
-rw-r--r--sys/miscfs/procfs/procfs_subr.c14
2 files changed, 22 insertions, 6 deletions
diff --git a/sys/fs/procfs/procfs_subr.c b/sys/fs/procfs/procfs_subr.c
index 12dcf76..e13e425 100644
--- a/sys/fs/procfs/procfs_subr.c
+++ b/sys/fs/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 <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);
}
}
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 <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);
}
}
OpenPOWER on IntegriCloud