Greetings.
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?
I've got a filesystem mounted from the NetApp to the FreeBSD machine, exported as:
/vol/vol0/home -access=client_hostname,anon=0
It's mounted on the client rw,intr,nfsv2.
When I run a program as uid 0 that does simply an opendir()/closedir() on a directory, the directory's st.st_atime gets updated. When I run the same program as uid > 0 (in this case, 51, to be exact), atime does not get updated.
I'm obviously missing my NFS roll here. Whassup with that? Shouldn't client requests as non-uid 0 also update atime? (Because I know somebody will ask, no_atime_update is not set on the volume. :) )
Am I just plain not understanding the man pages?
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
Bombs don't kill people. Explosions kill people.
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.
I've got a filesystem mounted from the NetApp to the FreeBSD machine, exported as:
/vol/vol0/home -access=client_hostname,anon=0
It's mounted on the client rw,intr,nfsv2.
When I run a program as uid 0 that does simply an opendir()/closedir() on a directory, the directory's st.st_atime gets updated.
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).
When I run the same program as uid > 0 (in this case, 51, to be exact), atime does not get updated.
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.
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.