On Thu, 25 Feb 1999 01:17:04 PST, Guy Harris wrote:
Is it the correct NFS behavior for non-uid-0 users opendir() calls to not update st.st_atime, but uid-0 opendir() calls to do so?
No. In fact, "opendir()", unless it does read-ahead, shouldn't update the access time of the directory being opened, period; opens don't modify the access time, just reads, on the UNIX-flavored systems I've seen.
When I run the following C program on FreeBSD 2.2.5-STABLE, st.st_atime is updated if the program is run as root; it is not if it is run as the user:
#include <sys/types.h> #include <dirent.h> main() { DIR *dir; dir = opendir("/nfs/mounted/partition/directory"); closedir(dir); exit(0); }
That seems to be in contradiction to what you're saying?
The part that most confuses me is the root/non-root difference. I'm unaware why the uid would impact this one way or the other (given correct mounting options).
A quick look at the FreeBSD 2.2.7 code doesn't show anything that should cause any reads to be done from the file when you do an "opendir()", although I'd have to look closer at "_seekdir()" to see if "closedir()" might somehow cause reading (that'd be silly, but perhaps there's either a bug, or that silliness is worth whatever other benefits it brings).
I didn't get deep enough into it to look through _seekdir(). I'll do that. Thanks for the nudge.
It might be interesting to run the program under a system call tracer, both as root and non-root, to see if the access time updating is being done from userland or if it's buried in the kernel.
Another good point.
Obviously, I need to get deeper into the system code. Thanks for the thoughts, Guy!
Brett
--- Brett Rabe Email : brett@uswest.net Systems Administrator - U S West Phone : 612.664.3078 Interact - 3S Pager : 612.613.2549 600 Stinson Blvd. Fax : 612.664.4770 Minneapolis, MN 55413 USA Pager : page-brett@uswest.net
As X approaches infinity, X gets pretty damn big.