[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

v_usecount in struct vnode



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