From owner-freebsd-hackers@FreeBSD.ORG Mon Feb 21 12:28:52 2005 Return-Path: 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 C608116A4CE for ; Mon, 21 Feb 2005 12:28:52 +0000 (GMT) Received: from cyrus.watson.org (cyrus.watson.org [204.156.12.53]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6D1CC43D48 for ; Mon, 21 Feb 2005 12:28:52 +0000 (GMT) (envelope-from robert@fledge.watson.org) Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by cyrus.watson.org (Postfix) with SMTP id 042E746B49; Mon, 21 Feb 2005 07:28:52 -0500 (EST) Date: Mon, 21 Feb 2005 12:27:16 +0000 (GMT) From: Robert Watson X-Sender: robert@fledge.watson.org To: Igor Shmukler In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-hackers@freebsd.org Subject: Re: vn_fullpath() X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Feb 2005 12:28:52 -0000 On Sun, 20 Feb 2005, Igor Shmukler wrote: > I was wondering if anyone has figured a way to make vn_fullpath() > reliable? It depends a lot on the requirements. There are some nasty edge cases where the process of determining a name for an object can be quite expensive. Here's one of them: ln /usr/local/etc/apache/httpd.conf /usr/local/etc/apache.old/httpd.conf reboot apachectl start rm /usr/local/etc/apache/httpd.conf Now generate the name of the file that Apache has open. Note that you can't just look in the name cache, because the object has a name but the name used to open the object has been invalidated. And UFS even knows it has a name, because the link count remains non-zero when the unlink of one of the names occurs -- but the only way it can find the other name is to search the file system. So the first thing to do is to decied what your requirements are: are you willing to fail in the edge cases like the above? If so, life is a lot easier :-). Robert N M Watson