From owner-freebsd-current Wed Dec 13 14:03:25 1995 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id OAA28737 for current-outgoing; Wed, 13 Dec 1995 14:03:25 -0800 (PST) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id OAA28731 for ; Wed, 13 Dec 1995 14:03:19 -0800 (PST) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id PAA00508 for current@freebsd.org; Wed, 13 Dec 1995 15:02:51 -0700 From: Terry Lambert Message-Id: <199512132202.PAA00508@phaeton.artisoft.com> Subject: Amusing vfs_cache bug To: current@freebsd.org Date: Wed, 13 Dec 1995 15:02:51 -0700 (MST) X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-current@freebsd.org Precedence: bulk In the process of some stress testing, I discovered an interesting vcache bug. It has to do with the first vnode allocated after the nextvnodeid rolls over and the cache is purged. As you can imagine, the stress involves more than 4 billion vnode allocations. Unlikely to happen unless you are me, or you are running a news spool. 8-). The v_id of the vnode after the rollover will be 1, which will match the v_id of the nchENOENT.v_id (the negative cahe hit entry). In the case of a rename of that file into a directory where a negative cache entry had occurred (access/open/etc. failed), the dvp, dvpid, vpid, v_vid, and the hash and name will match. But the vnode returned will be the negative hit. It has to be a rename, since a create checks for MAKEENTRY and a rename won't unset it. Kludgy patch follows. I really wanted to fix this by moving the cache lookup and entry and providing a purge by dvp function, but don't have time for that right this second. 8-(. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers. ========================================================================== *** vfs_cache.c.org Wed Dec 13 14:43:29 1995 --- vfs_cache.c Wed Dec 13 14:44:50 1995 *************** *** 253,258 **** --- 253,259 ---- TAILQ_INIT(&nclruhead); nchashtbl = phashinit(desiredvnodes, M_CACHE, &nchash); nchENOENT.v_id = 1; + nextvnode = 1; } /* *************** *** 278,284 **** while(ncpp->lh_first) PURGE(ncpp->lh_first); } ! vp->v_id = ++nextvnodeid; } /* --- 279,285 ---- while(ncpp->lh_first) PURGE(ncpp->lh_first); } ! vp->v_id = nextvnodeid = 2; } /* ==========================================================================