> > Additionally, you may want to make a note in the stat/lstat man page that on

> > Linux, lstat(2) will generally not trigger automounter action, whereas
> > stat(2) will.
> 
> I don't understand this last piece.  Can you say some more.  (I'm not
> familiar with automounter details.)
 
An automounter (either an explicit one, like autofs, or an implicit
one, such as are used by AFS or NFSv4) is something that triggers
a mount when something is touched.
 
However, it's undesirable to automount, say, everyone's home
directory just because someone opened up /home in their GUI
browser or typed "ls -l /home".  The early automounters simply
didn't list the contents until you accessed it by name;
this is still the case when you can't enumerate a mapping
(say, all DNS names under /net).  However, this is extremely
inconvenient, too.
 
The solution we ended up settling on is to create something
that looks like a directory (i.e. reports S_IFDIR in stat()),
but behaves somewhat like a symlink.  In particular, when it is
accessed in a way where a symlink would be dereferenced,
the automount triggers and the directory is mounted.  However,
system calls which do *not* cause a symlink to be dereferenced,
like lstat(), also do not cause the automounter to trigger.
This means that "ls -l", or a GUI file browser, can see a list
of directories without causing each one of them to be automounted.
 
        -hpa
This commit is contained in:
Michael Kerrisk 2008-09-10 10:40:01 +00:00
parent da1eef3d9d
commit 82d2be3d9d
1 changed files with 7 additions and 2 deletions

View File

@ -37,7 +37,7 @@
.\" 2007-06-08 mtk: Added example program
.\" 2007-07-05 mtk: Added details on underlying system call interfaces
.\"
.TH STAT 2 2008-09-09 "Linux" "Linux Programmer's Manual"
.TH STAT 2 2008-09-10 "Linux" "Linux Programmer's Manual"
.SH NAME
stat, fstat, lstat \- get file status
.SH SYNOPSIS
@ -413,7 +413,6 @@ e000 S_IFWHT w% 160000 BSD whiteout (not used for inode)
A sticky command appeared in Version 32V AT&T UNIX.
.SH NOTES
.SS Linux Notes
Since kernel 2.5.48, the
.I stat
structure supports nanosecond resolution for the three
@ -435,6 +434,12 @@ these nanosecond fields are returned with the value 0.
.\" but ext2, ext3, and Reiserfs do not.
.\" FIXME . SUSv4 specifies nanosecond timestamps.
On Linux,
.BR lstat ()
will generally not trigger automounter action, whereas
.BR stat()
will.
For most files under the
.I /proc
directory,