From nobody@FreeBSD.ORG Sat Apr 24 10:37:14 1999
Return-Path: <nobody@FreeBSD.ORG>
Received: by hub.freebsd.org (Postfix, from userid 32767)
	id DE82515168; Sat, 24 Apr 1999 10:37:14 -0700 (PDT)
Message-Id: <19990424173714.DE82515168@hub.freebsd.org>
Date: Sat, 24 Apr 1999 10:37:14 -0700 (PDT)
From: will@iki.fi
Sender: nobody@FreeBSD.ORG
To: freebsd-gnats-submit@freebsd.org
Subject: Variable wraparound in kern/vfs_cache.c:cache_purge can cause lockup
X-Send-Pr-Version: www-1.0

>Number:         11307
>Category:       kern
>Synopsis:       Variable wraparound in kern/vfs_cache.c:cache_purge can cause lockup
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Apr 24 10:40:00 PDT 1999
>Closed-Date:    Sat Apr 24 10:58:20 PDT 1999
>Last-Modified:  Sat Apr 24 10:59:10 PDT 1999
>Originator:     Ville-Pertti Keinonen
>Release:        Versions 3.0/3.1 and -current are affected.
>Organization:
>Environment:
>Description:
In versions of kern/vfs_cache.c starting with 1.31, the loop to
find a usable 'nextid' in cache_purge doesn't increment nextid, so
if the loop condition fails (e.g. if nextid is zero -- like it is
after it wraps), it loops forever.

I tried mailing phk (who introduced the bug and is, I believe,
the man behind the "new" namecache code) a couple of days ago and
received an error from his fetchmail-daemon, so I don't know if he
got the message.

The comment above cache_purge is also a bit out-of-date (it describes
what the code used to do), as are most of the comments in
vfs_cache.c...
>How-To-Repeat:

>Fix:
Increment nextid in the loop in addition to incrementing it before
the loop or use a do nextid++ while (old conditions); loop structure.

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: phk 
State-Changed-When: Sat Apr 24 10:58:20 PDT 1999 
State-Changed-Why:  
fixed, thanks. 

Did you actually hit this problem ? 
>Unformatted:
