From owner-freebsd-current Mon Oct 16 11:49:02 1995 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id LAA17111 for current-outgoing; Mon, 16 Oct 1995 11:49:02 -0700 Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id LAA17106 for ; Mon, 16 Oct 1995 11:48:56 -0700 Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id LAA25077; Mon, 16 Oct 1995 11:44:02 -0700 From: Terry Lambert Message-Id: <199510161844.LAA25077@phaeton.artisoft.com> Subject: Re: lstat flushes namei cache entry To: bde@zeta.org.au (Bruce Evans) Date: Mon, 16 Oct 1995 11:44:01 -0700 (MST) Cc: current@freebsd.org In-Reply-To: <199510161138.VAA24539@godzilla.zeta.org.au> from "Bruce Evans" at Oct 16, 95 09:38:02 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Length: 2576 Sender: owner-current@freebsd.org Precedence: bulk > lstat() has been inefficient since symlinks were POSIXified. > > Bruce > > *** vfs_lookup.c~ Fri Aug 25 16:05:33 1995 > --- vfs_lookup.c Mon Oct 16 21:06:30 1995 > *************** > *** 267,272 **** > wantparent = cnp->cn_flags & (LOCKPARENT | WANTPARENT); > docache = (cnp->cn_flags & NOCACHE) ^ NOCACHE; > if (cnp->cn_nameiop == DELETE || > ! (wantparent && cnp->cn_nameiop != CREATE)) > docache = 0; > rdonly = cnp->cn_flags & RDONLY; > --- 280,297 ---- > wantparent = cnp->cn_flags & (LOCKPARENT | WANTPARENT); > docache = (cnp->cn_flags & NOCACHE) ^ NOCACHE; > + /* > + * XXX the following seems to be just to recover from not setting > + * NOCACHE for the DELETE cases (unlink, rmdir and the rename > + * source). In BSD4.4lite[2], docache was also cleared for the > + * (wantparent && cnp->cn_nameiop == LOOKUP) case. This case > + * seems to only occur for lstat and olstat, when it is wrong > + * to clear docache. This case probably didn't occur before > + * BSD4.4lite. LOCKPARENT was introduced for lstat to support > + * the new behaviour of symlinks (attributes inherited from the > + * parent. > + */ > if (cnp->cn_nameiop == DELETE || > ! (wantparent && cnp->cn_nameiop != CREATE && > ! cnp->cn_nameiop != LOOKUP)) > docache = 0; > rdonly = cnp->cn_flags & RDONLY; This will INCORRECTLY result in the contents of symlinks being seen as successfully looked up inferior components and entered into the cache. This is *BROKEN*. Consider: cd /tmp mkdir foo cp /etc/ttys foo mkdir fee cd fee ln -s /tmp/foo/ttys xxx ls xxx ls foo The *correct* set of fixes for this is moving the cache lookup into vfs_lookup.c instead of calling it per FS lookup mechanism. If I can't get a simple interface change into -current, it's unlikely that something that large in scope would go in (I would need to have the ability to disable it on a per FS type basis, etc.). Integrate my other changes first, and my patches to nameifree() and nfs_nameifree() to avoid duplicate free's, please. Then we can go off and consider moving the name cache. Also run the "find' I asked for for the cn_pnbuf references *after* the patches are applies so we can missed patches because of parallel development on things like procfs and devfs. Thanks, Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.