[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
v_usecount in struct vnode
- To: tech_(_at_)_openbsd_(_dot_)_org
- Subject: v_usecount in struct vnode
- From: Niels Provos <provos_(_at_)_citi_(_dot_)_umich_(_dot_)_edu>
- Date: Wed, 14 Oct 1998 19:24:59 -0400
- Delivery-date: Wed Oct 14 16:30:17 1998
Hi,
a DIAGNOSTIC kernel panics on close with a bad vrele: ref cnt, when a file
has been opened more than 32768 times.
This is because v_usecount is a short and overflows to a negative number.
There should be a check in vget to avoid this situation, what about
In vfs_subr.c:
vget()
..
vp->v_flag &= ~VONFREELIST;
}
+ if (vp->v_usecount + 2 <= 0)
+ return (ENFILE);
vp->v_usecount++;
if (flags & LK_TYPE_MASK) {
[+ 2 because we need to leave room for vclean].
Even though this might be pathological, it should be fixed.
Greetings,
Niels
Visit your host, monkey.org