From owner-freebsd-hackers Thu Jul 4 17:56:30 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EA73337B400 for ; Thu, 4 Jul 2002 17:56:27 -0700 (PDT) Received: from ns.aus.com (adsl-64-175-247-40.dsl.sntc01.pacbell.net [64.175.247.40]) by mx1.FreeBSD.org (Postfix) with ESMTP id BF01943E09 for ; Thu, 4 Jul 2002 17:56:26 -0700 (PDT) (envelope-from rsharpe@ns.aus.com) Received: from localhost (rsharpe@localhost) by ns.aus.com (8.11.6/8.11.6) with ESMTP id g6528Ul04471 for ; Fri, 5 Jul 2002 11:38:30 +0930 Date: Fri, 5 Jul 2002 11:38:30 +0930 (CST) From: Richard Sharpe To: Subject: Adding readdir entries to the name cache ... Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi, I am interested in hearing opinions on whether or not it is useful to preload entries into the name cache that are obtained with readdir/getdirentries/getdents. We recently had a problem of the kernel hanging because we were loading entries into the name that were being picked up using readdir/getdirentries/getdents. These entries were inserted using cache_entry, which seems not to check that the entry is already in the cache, it simply inserts it. (Normally, cache_entry is called because a VOP routine was told to MAKEENTRY). Eventually, especially because Samba was running on the system[1], we ran out of space in the VFSCACHE, and the system hung. It seemed to me that one way to fix that would be to check whether an entry was in the name cache before trying to load it, however, I wonder at the wisdom of trying to do so, and feel that the current situation might be more than satisfactory. The most obvious reason for loading readdir entries is to handle ls -l. Since ls has to read the directory enties, which it does with getdirentries, and then has to stat the entries, which would cause it to do a lookup on the name and then retrieve the vnode/inode, it would seem to be a win if we preload the entries in the name cache. However, ls seems to call lstat in the same order that the files are in the directory, and a normal clock approach to directories would yield exactly the same result. Further, in the cases that the user did not want a -l, we would avoid adding many potentially useless names to the name cache and reducing its performance. [1] Samba, because it has to support the Windows case insensitive file system, must do some pretty ugly things :-) When a client asks that a file be opened, for example, Samba tries with exactly the case that was presented. If that fails, it must do a readdir scan of the directory so it can do a case-insensitive match. So, even negative caching does not buy us much in the the case of Samba. What would help is a case insensitive filesystem. Regards ----- Richard Sharpe, rsharpe@ns.aus.com, rsharpe@samba.org, sharpe@ethereal.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message