Subject: kern/28472: NFS client gets atime wrong
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <marcotte@panix.com>
List: netbsd-bugs
Date: 11/30/2004 00:24:00
>Number: 28472
>Category: kern
>Synopsis: NFS client gets atime wrong
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Nov 30 00:24:00 +0000 2004
>Originator: Brian Marcotte
>Release: NetBSD 2.0_RC4
>Organization:
panix.com
>Environment:
kernel and userland match
System: NetBSD panix5.panix.com 2.0_RC4 NetBSD 2.0_RC4 (PANIX-USER) #0: Sat Nov 6 19:39:39 EST 2004 root@trinity.nyc.access.net:/devel/netbsd/release-2.0-20041022/src/sys/arch/i386/compile/PANIX-USER i386
Architecture: i386
Machine: i386
>Description:
The NFS client sometimes updates the atime when it shouldn't or
doesn't update it when it should. Or perhaps the NFS client does
not do the right things to make the server update, or not update
the atime.
This can cause programs which check for new mail to never report
the presence of new mail. It appears that on mail delivery the
atime is set to the mtime (the time of delivery) which is
incorrect behavior.
Note that our NFS server is a NetAPP and hasn't changed in years.
We noticed this problem in 2.0. I don't know if its a problem in
the 1.6 series. It worked fine in 1.5.
>How-To-Repeat:
This short script will show the problem. Run it in an NFS mounted
directory.
In the first example, it is interesting that the problem occurs
only when the numbers of writes is 2 or greater ("count=2").
I have verified that this works fine on FFS.
#!/bin/sh
rm -f file
echo "Example where atime is updated when it shouldn't be."
echo "This is similar to when mail is delivered to a mailbox."
echo
for x in 1 2 3 ; do
dd if=/dev/zero bs=1 count=2 2> /dev/null >> file
echo -n "mtime: " ; ls -lT file
echo -n "atime: " ; ls -luT file
echo
sleep 3
done
echo
rm -f file
echo "Example where atime is NOT updated when it should be:"
echo
touch file
for x in 1 2 3 ; do
cat file > /dev/null
echo -n "mtime: " ; ls -lT file
echo -n "atime: " ; ls -luT file
echo
sleep 3
done
Here is the output on my system:
Example where atime is updated when it shouldn't be.
This is similar to when mail is delivered to a mailbox.
mtime: -rw-r--r-- 1 marcotte staff 2 Nov 29 19:14:38 2004 file
atime: -rw-r--r-- 1 marcotte staff 2 Nov 29 19:14:38 2004 file
mtime: -rw-r--r-- 1 marcotte staff 4 Nov 29 19:14:41 2004 file
atime: -rw-r--r-- 1 marcotte staff 4 Nov 29 19:14:41 2004 file
mtime: -rw-r--r-- 1 marcotte staff 6 Nov 29 19:14:44 2004 file
atime: -rw-r--r-- 1 marcotte staff 6 Nov 29 19:14:44 2004 file
Example where atime is NOT updated when it should be:
mtime: -rw-r--r-- 1 marcotte staff 0 Nov 29 19:14:47 2004 file
atime: -rw-r--r-- 1 marcotte staff 0 Nov 29 19:14:47 2004 file
mtime: -rw-r--r-- 1 marcotte staff 0 Nov 29 19:14:47 2004 file
atime: -rw-r--r-- 1 marcotte staff 0 Nov 29 19:14:47 2004 file
mtime: -rw-r--r-- 1 marcotte staff 0 Nov 29 19:14:47 2004 file
atime: -rw-r--r-- 1 marcotte staff 0 Nov 29 19:14:47 2004 file
>Fix:
unknown