[OpenAFS-devel] recursive find

Jeffrey Hutzelman jhutz@cmu.edu
Fri, 6 Jul 2001 10:19:09 -0400 (EDT)


On Fri, 6 Jul 2001, Andreas V. Meier wrote:

> I just experienced a problem with recursive find.
> This seems to be some problem with afs, because on ext2 and any other it
> works.
> (ok, might be a feature and not a bug, just tell me,)
> 
> At the rootdir of a mounted afsvolume on my linuxbox i issued a
>         find . -type d -print
> The options do not really matter, but what I have seen is that find only
> showed me the contents of the current directory, it did not go through
> subdirs.
> 
> It worked as I assumed from any deeper directory, just not from the
> volume-rootdir.


It sounds like you are using GNU find, which does an optimization to avoid
statting things that it "knows" are files, based on the link count of the
directory it is scanning and the number of directories it has encountered
so far.  Unfortunately, the assumption it makes is not always valid in
AFS; in particular, it doesn't work if the directory being scanned
contains any mount points, because those look like directories but don't
count against the parent's link count.

The workaround is to use the -noleaf switch, which tells find not to do
this optimization.

-- Jeffrey T. Hutzelman (N3NHS) <jhutz+@cmu.edu>
   Sr. Research Systems Programmer
   School of Computer Science - Research Computing Facility
   Carnegie Mellon University - Pittsburgh, PA