I have an odd automount problem. The first time I look in an automounted filesystem (when the mount is requested), it is empty; the second time it is not. Moreover, I only see this behavior on Centos 4.x systems, but not on Centos 5.0 systems going to the same fileserver. Here's an example, with some details simplified to clarify. In this example, fileserver1 is exporting fs1.
centos4$ /bin/ls /mnt/fileserver1/fs1 # first time, directory looks empty centos4$ /bin/ls /mnt/fileserver1/fs1 # second time, I see the contents file1 dir2
I don't see this on Centos 5, which comes with a new (v5.x vs v4.x) version of automount:
centos5$ /bin/ls /mnt/fileserver1/fs1 # I see the contents right away, on the first try file1 dir2
I watched the logs on fileserver1, and automount request is logged immediately after the first ls prints nothing.
The automount maps are stored in ldap. The Centos4 and Centos5 systems are referencing the same maps. The entry in auto.master for fileserver1 (for cn=/mnt/fileserver1) is:
ldap:ou=auto.fileserver1,ou=autofs,dc=example,dc=com --timeout=86400 --ghost -o rw,hard,async,noatime,intr,retrans=4,timeo=100,rsize=8192,wsize=8192
and in auto.fileserver1 is (for cn=*):
fileserver1.example.com:/export/&
At first I thought it had to do with the --ghost, but I took that out and adjusted things and still had the same problem. It is completely reproducible if I umount the automount between tries.
Any idea what is causing this? I have been unable to find a similar-sounding problem, even with extensive Googling. Why does the first automount appear to be asynchronous, with some kind of race condition, and the second is synchronous? I even see a little hesitation on the centos5 box before ls prints the directory contents, so it appears to be waiting for the automount to complete. All the Centos 4 and Centos 5 boxes are current with "yum update".
This problem is causing failures on some of our applications because they don't see their data the first time they run, when the automount occurs
We see this across many boxes, and several fileservers (the fileservers are Fedora Core 5 and 6 machines, for stupid reasons).
Thanks, Dan