vn_fullpath()

Robert Watson rwatson at FreeBSD.org
Mon Feb 21 04:28:52 PST 2005


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




More information about the freebsd-hackers mailing list