[OpenAFS] Re: OpenAFS-info digest, Vol 1 #905 - 4 msgs

Chaskiel M Grundman cg2v@andrew.cmu.edu
Tue, 05 Nov 2002 12:44:37 -0500


--On Tuesday, November 05, 2002 12:04:26 -0500 James L Robinson 
<jlrobins@uncc.edu> wrote:

>> Would be nice if it did not cross volume mounts.
>
> GNU find won't cross volume mountpoints by default, that is,
> without the '-noleaf' option. YMMV.

That's not actually what it does. It does exactly what it says it does. it 
counts things that stat() says are directories, but only until it reaches 
the number that st_nlink on the current directory implies that there should 
be. So, if you have a directory like this:

.
..
a-is-a-mountpoint
b-is-a-directory

GNU find (w/o -noleaf) will traverse 'a...', but not 'b...', because the 
nlink on . is 3.

The 'right' way of detecting mountpoints without using pioctl() is to use 
the even-odd rule: Directories in afs have odd inode numbers, while files 
and symlinks have even inode numbers. Since mountpoints are stored as 
symlinks, stat'ing one will return a mode of S_ISDIR (like a real 
directory), and an even inode number (not like a real directory).