Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Nov 1995 08:37:48 +0800 (WST)
From:      Peter Wemm <peter@haywire.DIALix.COM>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: How can I remove hard links between directories?
Message-ID:  <Pine.SV4.3.91.951128083033.2911A-100000@haywire.DIALix.COM>
In-Reply-To: <199511271830.FAA20667@godzilla.zeta.org.au>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 28 Nov 1995, Bruce Evans wrote:
> >or things like inn's fastrm program that have to test if the euid ==
> >0, and if so, it has to stat() every single file it's processing to
> >make sure it's not about to unlink a directory and running much slower
> >from the extra overhead..  (side note, always expire news as uid
> >"news" for this very reason).
> 
> Why would it be much slower?  unlink() is very slow if writes are
> synchronous.  Here repeated stats of the same file take 81 usec while
> creat+close+unlink of the same file takes 5000 usec.

Because if it's running as root, it has to stat() the filenames first to
make sure it's not going to accidently unlink a directory (recent example:
the newsgroup alt.2600.441 was created in the alt.2600 article stream). 
Actually, my use of "much" is probably wrong as long as some of the work
to do the stat() call is cached and reused for the unlink().  I have not 
used fastrm as root on FreeBSD, but I remember some pretty damning 
comments from Rich Salz/Robert Elz on the subject for SunOS.

-Peter

> Bruce
> 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SV4.3.91.951128083033.2911A-100000>