Skip to contentSkip to conversation

NFS client: utime() doesn't work always

DISCUSSION Timo Sirainen 2 participants 2 messages Apr 20, 2006

lore
Share & tools
lore
#0 lore raw

Attached two straces where in first one stat() right after utime() gives wrong mtime in reply. The second strace has fstat() call added which makes it work properly for some reason (most of the time, but not always).

I tried creating a small test program which did the last steps in the straces, but I couldn't reproduce the problem with it. So I guess some other syscall before those causes it to get confused.

The NFS server's clock seems to be about 4 seconds in different time from the client. I guess that's part of the reason why it's wrong. Linux kernel figures that because utime() doesn't actually change the mtime it doesn't bother updating it? If this is the case, I think it should be changed because the clocks can't be perfectly sychronized, so there's always some possibility for it to break.

Kernel is from Debian package linux-image-2.6.16-1-686-smp version 2.6.16-7. NFS server is some Netapp, mounted with options rw,noatime,nfsvers=3,proto=udp,rsize=32768,wsize=32768,actimeo=30. Same with actimeo=0. 2.4.20 used to work fine.

execve("./imap", ["./imap"], [/* 24 vars */]) = 0
uname({sysname="Linux", nodename="fe3-mail", release="2.6.16-1-686-smp", version="#2 SMP Sat Apr 15 20:52:13 UTC 2006", machine="i686"}) = 0
brk(0) = 0x80d1000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xa7fd9000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xa7fd8000
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat64(3, {st_dev=makedev(72, 1), st_ino=260168, st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=32, st_size=12906, st_atime=2006/04/20-12:37:59, st_mtime=2006/04/19-11:55:41, st_ctime=2006/04/19-11:55:41}) = 0 mmap2(NULL, 12906, PROT_READ, MAP_PRIVATE, 3, 0) = 0xa7fd4000

close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/tls/libdl.so.2", O_RDONLY)   = 3

read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\20\f\0"..., 512) = 512
fstat64(3, {st_dev=makedev(72, 1), st_ino=569320, st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=24, st_size=9592, st_atime=2006/04/20-12:37:59, st_mtime=2006/04/14-17:09:04, st_ctime=2006/04/18-13:37:56}) = 0 mmap2(NULL, 12404, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xa7fd0000
mmap2(0xa7fd2000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1) = 0xa7fd2000

close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/tls/libc.so.6", O_RDONLY)    = 3

read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\260O\1"..., 512) = 512
fstat64(3, {st_dev=makedev(72, 1), st_ino=569317, st_mode=S_IFREG|0755, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=2496, st_size=1270928, st_atime=2006/04/20-12:37:59, st_mtime=2006/04/14-17:09:04, st_ctime=2006/04/18-13:37:56}) = 0 mmap2(NULL, 1276892, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xa7e98000
mmap2(0xa7fc6000, 32768, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x12e) = 0xa7fc6000
mmap2(0xa7fce000, 7132, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xa7fce000
close(3) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xa7e97000
mprotect(0xa7fc6000, 20480, PROT_READ) = 0
set_thread_area({entry_number:-1 -> 6, base_addr:0xa7e976c0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0

munmap(0xa7fd4000, 12906)               = 0
getuid32()                              = 1014
time(NULL)                              = 1145533079
brk(0)                                  = 0x80d1000
brk(0x80fa000)                          = 0x80fa000
uname({sysname="Linux", nodename="fe3-mail", release="2.6.16-1-686-smp", version="#2 SMP Sat Apr 15 20:52:13 UTC 2006", machine="i686"}) = 0
getpid()                                = 1000
open("/dev/urandom", O_RDONLY|O_LARGEFILE) = 3
read(3, "\30\3663i", 4)                 = 4
fcntl64(3, F_GETFD)                     = 0
fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0

gettimeofday({1145533079, 140184}, {4294967236, 0}) = 0
pipe([4, 5]) = 0
fcntl64(4, F_GETFL) = 0 (flags O_RDONLY)
fcntl64(4, F_SETFL, O_RDONLY|O_NONBLOCK) = 0
fcntl64(5, F_GETFL) = 0x1 (flags O_WRONLY)
fcntl64(5, F_SETFL, O_WRONLY|O_NONBLOCK) = 0

fcntl64(4, F_GETFD)                     = 0
fcntl64(4, F_SETFD, FD_CLOEXEC)         = 0
fcntl64(5, F_GETFD)                     = 0
fcntl64(5, F_SETFD, FD_CLOEXEC)         = 0
rt_sigaction(SIGIO, {SIG_IGN}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGRT_2, {0x80b5aa0, [], SA_RESTART|SA_NOMASK|SA_SIGINFO}, NULL, 8) = 0
rt_sigaction(SIGINT, {0x80b6560, [], 0}, NULL, 8) = 0
pipe([6, 7])                            = 0
fcntl64(6, F_GETFD)                     = 0
fcntl64(6, F_SETFD, FD_CLOEXEC)         = 0
fcntl64(7, F_GETFD)                     = 0
fcntl64(7, F_SETFD, FD_CLOEXEC)         = 0

rt_sigaction(SIGTERM, {0x80b6560, [], 0}, NULL, 8) = 0 rt_sigaction(SIGPIPE, {SIG_IGN}, NULL, 8) = 0
rt_sigaction(SIGALRM, {SIG_IGN}, NULL, 8) = 0 lstat64("/home/tss/mails/cur", 0xafbebf80) = -1 ENOENT (No such file or directory)
mkdir("/home/tss/mails/cur", 0770) = 0
lstat64("/home/tss/mails/new", 0xafbebf80) = -1 ENOENT (No such file or directory)
mkdir("/home/tss/mails/new", 0770) = 0
lstat64("/home/tss/mails/tmp", 0xafbebf80) = -1 ENOENT (No such file or directory)

mkdir("/home/tss/mails/tmp", 0770)      = 0
fcntl64(0, F_GETFL)                     = 0x2 (flags O_RDWR)
fcntl64(0, F_SETFL, O_RDWR|O_NONBLOCK)  = 0
fcntl64(1, F_GETFL)                     = 0x802 (flags O_RDWR|O_NONBLOCK)
fcntl64(1, F_SETFL, O_RDWR|O_NONBLOCK)  = 0

fstat64(0, {st_dev=makedev(0, 10), st_ino=2, st_mode=S_IFCHR|0620, st_nlink=1, st_uid=1014, st_gid=5, st_blksize=1024, st_blocks=0, st_rdev=makedev(136, 0), st_atime=2006/04/20-12:37:59, st_mtime=2006/04/20-12:37:59, st_ctime=2006/04/19-12:27:53}) = 0
_llseek(1, 0, 0xafbec040, SEEK_CUR) = -1 ESPIPE (Illegal seek)
getsockname(1, 0xafbec020, [28]) = -1 ENOTSOCK (Socket operation on non-socket)
write(1, "* PREAUTH [CAPABILITY IMAP4rev1 "..., 144) = 144
gettimeofday({1145533079, 152352}, NULL) = 0
poll([{fd=6, events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=0, events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL, revents=POLLIN}], 2, 9987) = 1
gettimeofday({1145533082, 993696}, {4294967236, 0}) = 0
read(0, "x append inbox {10}\n", 4096) = 20

lstat64("/home/tss/mails/cur", {st_dev=makedev(0, 14), st_ino=1152276, st_mode=S_IFDIR|0750, st_nlink=2, st_uid=1014, st_gid=1014, st_blksize=32768, st_blocks=8, st_size=4096, st_atime=2006/04/20-12:38:03, st_mtime=2006/04/20-12:38:03, st_ctime=2006/04/20-12:38:03}) = 0
lstat64("/home/tss/mails/new", {st_dev=makedev(0, 14), st_ino=1152277, st_mode=S_IFDIR|0750, st_nlink=2, st_uid=1014, st_gid=1014, st_blksize=32768, st_blocks=8, st_size=4096, st_atime=2006/04/20-12:38:03, st_mtime=2006/04/20-12:38:03, st_ctime=2006/04/20-12:38:03}) = 0
lstat64("/home/tss/mails/tmp", {st_dev=makedev(0, 14), st_ino=1152278, st_mode=S_IFDIR|0750, st_nlink=2, st_uid=1014, st_gid=1014, st_blksize=32768, st_blocks=8, st_size=4096, st_atime=2006/04/20-12:38:03, st_mtime=2006/04/20-12:38:03, st_ctime=2006/04/20-12:38:03}) = 0

stat64("/home/tss/mails/dovecot-shared", 0xafbebf20) = -1 ENOENT (No such file or directory)
time(NULL) = 1145533082
time(NULL) = 1145533082
stat64("/home/tss/mails/new", {st_dev=makedev(0, 14), st_ino=1152277, st_mode=S_IFDIR|0750, st_nlink=2, st_uid=1014, st_gid=1014, st_blksize=32768, st_blocks=8, st_size=4096, st_atime=2006/04/20-12:38:03, st_mtime=2006/04/20-12:38:03, st_ctime=2006/04/20-12:38:03}) = 0 stat64("/home/tss/mails/cur", {st_dev=makedev(0, 14), st_ino=1152276, st_mode=S_IFDIR|0750, st_nlink=2, st_uid=1014, st_gid=1014, st_blksize=32768, st_blocks=8, st_size=4096, st_atime=2006/04/20-12:38:03, st_mtime=2006/04/20-12:38:03, st_ctime=2006/04/20-12:38:03}) = 0 stat64("/home/tss/mails/tmp/1145533082.P1000Q0M993696.fe3-mail", 0xafbebf20) = -1 ENOENT (No such file or directory)
umask(0) = 022
open("/home/tss/mails/tmp/1145533082.P1000Q0M993696.fe3-mail", O_WRONLY|O_CREAT|O_EXCL|O_LARGEFILE, 0600) = 8
umask(022) = 0
_llseek(8, 0, [0], SEEK_CUR) = 0
fstat64(8, {st_dev=makedev(0, 14), st_ino=1152279, st_mode=S_IFREG|0600, st_nlink=1, st_uid=1014, st_gid=1014, st_blksize=32768, st_blocks=0, st_size=0, st_atime=2006/04/20-12:38:07, st_mtime=2006/04/20-12:38:07, st_ctime=2006/04/20-12:38:07}) = 0

write(1, "+ OK\r\n", 6)                 = 6
read(0, 0x80dfeec, 4076)                = -1 EAGAIN (Resource temporarily unavailable)
gettimeofday({1145533083, 5745}, NULL)  = 0

poll([{fd=6, events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=0, events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=1, events=POLLOUT|POLLERR|POLLHUP|POLLNVAL, revents=POLLOUT}], 3, 6134) = 1 gettimeofday({1145533083, 6053}, {4294967236, 0}) = 0
gettimeofday({1145533083, 6145}, NULL) = 0
poll([{fd=6, events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=0, events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL, revents=POLLIN}], 2, 6133) = 1 gettimeofday({1145533084, 657821}, {4294967236, 0}) = 0

read(0, "From: foo\n", 4076)            = 10
write(8, "From: foo\n", 10)             = 10
close(8)                                = 0
gettimeofday({1145533084, 658682}, NULL) = 0
poll([{fd=6, events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=0, events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL, revents=POLLIN}], 2, 4481) = 1
gettimeofday({1145533085, 426512}, {4294967236, 0}) = 0
read(0, "\n", 4066)                     = 1
umask(0177)                             = 022
time(NULL)                              = 1145533085

lstat64("/home/tss/mails/dovecot-uidlist.lock", 0xafbebe00) = -1 ENOENT (No such file or directory)
stat64("/home/tss/mails/temp.fe3-mail.1000.15836c2c6c0d52ff", 0xafbebdd0) = -1 ENOENT (No such file or directory)
open("/home/tss/mails/temp.fe3-mail.1000.15836c2c6c0d52ff", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0666) = 8
link("/home/tss/mails/temp.fe3-mail.1000.15836c2c6c0d52ff", "/home/tss/mails/dovecot-uidlist.lock") = 0
unlink("/home/tss/mails/temp.fe3-mail.1000.15836c2c6c0d52ff") = 0
fstat64(8, {st_dev=makedev(0, 14), st_ino=1152280, st_mode=S_IFREG|0600, st_nlink=2, st_uid=1014, st_gid=1014, st_blksize=32768, st_blocks=0, st_size=0, st_atime=2006/04/20-12:38:09, st_mtime=2006/04/20-12:38:09, st_ctime=2006/04/20-12:38:09}) = 0
umask(022) = 0177
open("/home/tss/mails/dovecot-uidlist", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
link("/home/tss/mails/tmp/1145533082.P1000Q0M993696.fe3-mail", "/home/tss/mails/new/1145533082.P1000Q0M993696.fe3-mail") = 0
unlink("/home/tss/mails/tmp/1145533082.P1000Q0M993696.fe3-mail") = 0
write(8, "1 0 2\n1 1145533082.P1000Q0M99369"..., 43) = 43
utime("/home/tss/mails/dovecot-uidlist.lock", [2006/04/20-12:38:05, 2006/04/20-12:38:05]) = 0
stat64("/home/tss/mails/dovecot-uidlist.lock", {st_dev=makedev(0, 14), st_ino=1152280, st_mode=S_IFREG|0600, st_nlink=2, st_uid=1014, st_gid=1014, st_blksize=32768, st_blocks=0, st_size=43, st_atime=2006/04/20-12:38:05, st_mtime=2006/04/20-12:38:09, st_ctime=2006/04/20-12:38:09}) = 0

execve("./imap", ["./imap"], [/* 24 vars */]) = 0
uname({sysname="Linux", nodename="fe3-mail", release="2.6.16-1-686-smp", version="#2 SMP Sat Apr 15 20:52:13 UTC 2006", machine="i686"}) = 0
brk(0) = 0x80d1000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xa7fb4000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xa7fb3000
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat64(3, {st_dev=makedev(72, 1), st_ino=260168, st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=32, st_size=12906, st_atime=2006/04/20-12:38:23, st_mtime=2006/04/19-11:55:41, st_ctime=2006/04/19-11:55:41}) = 0 mmap2(NULL, 12906, PROT_READ, MAP_PRIVATE, 3, 0) = 0xa7faf000

close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/tls/libdl.so.2", O_RDONLY)   = 3

read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\20\f\0"..., 512) = 512
fstat64(3, {st_dev=makedev(72, 1), st_ino=569320, st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=24, st_size=9592, st_atime=2006/04/20-12:38:23, st_mtime=2006/04/14-17:09:04, st_ctime=2006/04/18-13:37:56}) = 0 mmap2(NULL, 12404, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xa7fab000
mmap2(0xa7fad000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1) = 0xa7fad000

close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/tls/libc.so.6", O_RDONLY)    = 3

read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\260O\1"..., 512) = 512
fstat64(3, {st_dev=makedev(72, 1), st_ino=569317, st_mode=S_IFREG|0755, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=2496, st_size=1270928, st_atime=2006/04/20-12:38:23, st_mtime=2006/04/14-17:09:04, st_ctime=2006/04/18-13:37:56}) = 0 mmap2(NULL, 1276892, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xa7e73000
mmap2(0xa7fa1000, 32768, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x12e) = 0xa7fa1000
mmap2(0xa7fa9000, 7132, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xa7fa9000
close(3) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xa7e72000
mprotect(0xa7fa1000, 20480, PROT_READ) = 0
set_thread_area({entry_number:-1 -> 6, base_addr:0xa7e726c0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0

munmap(0xa7faf000, 12906)               = 0
getuid32()                              = 1014
time(NULL)                              = 1145533103
brk(0)                                  = 0x80d1000
brk(0x80fa000)                          = 0x80fa000
uname({sysname="Linux", nodename="fe3-mail", release="2.6.16-1-686-smp", version="#2 SMP Sat Apr 15 20:52:13 UTC 2006", machine="i686"}) = 0
getpid()                                = 1098
open("/dev/urandom", O_RDONLY|O_LARGEFILE) = 3
read(3, "\7\345z\271", 4)               = 4
fcntl64(3, F_GETFD)                     = 0
fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0

gettimeofday({1145533103, 381091}, {4294967236, 0}) = 0
pipe([4, 5]) = 0
fcntl64(4, F_GETFL) = 0 (flags O_RDONLY)
fcntl64(4, F_SETFL, O_RDONLY|O_NONBLOCK) = 0
fcntl64(5, F_GETFL) = 0x1 (flags O_WRONLY)
fcntl64(5, F_SETFL, O_WRONLY|O_NONBLOCK) = 0

fcntl64(4, F_GETFD)                     = 0
fcntl64(4, F_SETFD, FD_CLOEXEC)         = 0
fcntl64(5, F_GETFD)                     = 0
fcntl64(5, F_SETFD, FD_CLOEXEC)         = 0
rt_sigaction(SIGIO, {SIG_IGN}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGRT_2, {0x80b5ad0, [], SA_RESTART|SA_NOMASK|SA_SIGINFO}, NULL, 8) = 0
rt_sigaction(SIGINT, {0x80b6590, [], 0}, NULL, 8) = 0
pipe([6, 7])                            = 0
fcntl64(6, F_GETFD)                     = 0
fcntl64(6, F_SETFD, FD_CLOEXEC)         = 0
fcntl64(7, F_GETFD)                     = 0
fcntl64(7, F_SETFD, FD_CLOEXEC)         = 0

rt_sigaction(SIGTERM, {0x80b6590, [], 0}, NULL, 8) = 0 rt_sigaction(SIGPIPE, {SIG_IGN}, NULL, 8) = 0
rt_sigaction(SIGALRM, {SIG_IGN}, NULL, 8) = 0 lstat64("/home/tss/mails/cur", 0xafdc8c70) = -1 ENOENT (No such file or directory)
mkdir("/home/tss/mails/cur", 0770) = 0
lstat64("/home/tss/mails/new", 0xafdc8c70) = -1 ENOENT (No such file or directory)
mkdir("/home/tss/mails/new", 0770) = 0
lstat64("/home/tss/mails/tmp", 0xafdc8c70) = -1 ENOENT (No such file or directory)

mkdir("/home/tss/mails/tmp", 0770)      = 0
fcntl64(0, F_GETFL)                     = 0x2 (flags O_RDWR)
fcntl64(0, F_SETFL, O_RDWR|O_NONBLOCK)  = 0
fcntl64(1, F_GETFL)                     = 0x802 (flags O_RDWR|O_NONBLOCK)
fcntl64(1, F_SETFL, O_RDWR|O_NONBLOCK)  = 0

fstat64(0, {st_dev=makedev(0, 10), st_ino=2, st_mode=S_IFCHR|0620, st_nlink=1, st_uid=1014, st_gid=5, st_blksize=1024, st_blocks=0, st_rdev=makedev(136, 0), st_atime=2006/04/20-12:38:23, st_mtime=2006/04/20-12:38:23, st_ctime=2006/04/19-12:27:53}) = 0
_llseek(1, 0, 0xafdc8d30, SEEK_CUR) = -1 ESPIPE (Illegal seek)
getsockname(1, 0xafdc8d10, [28]) = -1 ENOTSOCK (Socket operation on non-socket)
write(1, "* PREAUTH [CAPABILITY IMAP4rev1 "..., 144) = 144
gettimeofday({1145533103, 393088}, NULL) = 0
poll([{fd=6, events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=0, events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL, revents=POLLIN}], 2, 9987) = 1
gettimeofday({1145533105, 719016}, {4294967236, 0}) = 0
read(0, "x append inbox {10}\n", 4096) = 20

lstat64("/home/tss/mails/cur", {st_dev=makedev(0, 14), st_ino=1152276, st_mode=S_IFDIR|0750, st_nlink=2, st_uid=1014, st_gid=1014, st_blksize=32768, st_blocks=8, st_size=4096, st_atime=2006/04/20-12:38:27, st_mtime=2006/04/20-12:38:27, st_ctime=2006/04/20-12:38:27}) = 0
lstat64("/home/tss/mails/new", {st_dev=makedev(0, 14), st_ino=1152277, st_mode=S_IFDIR|0750, st_nlink=2, st_uid=1014, st_gid=1014, st_blksize=32768, st_blocks=8, st_size=4096, st_atime=2006/04/20-12:38:27, st_mtime=2006/04/20-12:38:27, st_ctime=2006/04/20-12:38:27}) = 0
lstat64("/home/tss/mails/tmp", {st_dev=makedev(0, 14), st_ino=1152278, st_mode=S_IFDIR|0750, st_nlink=2, st_uid=1014, st_gid=1014, st_blksize=32768, st_blocks=8, st_size=4096, st_atime=2006/04/20-12:38:27, st_mtime=2006/04/20-12:38:27, st_ctime=2006/04/20-12:38:27}) = 0

stat64("/home/tss/mails/dovecot-shared", 0xafdc8c10) = -1 ENOENT (No such file or directory)
time(NULL) = 1145533105
time(NULL) = 1145533105
stat64("/home/tss/mails/new", {st_dev=makedev(0, 14), st_ino=1152277, st_mode=S_IFDIR|0750, st_nlink=2, st_uid=1014, st_gid=1014, st_blksize=32768, st_blocks=8, st_size=4096, st_atime=2006/04/20-12:38:27, st_mtime=2006/04/20-12:38:27, st_ctime=2006/04/20-12:38:27}) = 0 stat64("/home/tss/mails/cur", {st_dev=makedev(0, 14), st_ino=1152276, st_mode=S_IFDIR|0750, st_nlink=2, st_uid=1014, st_gid=1014, st_blksize=32768, st_blocks=8, st_size=4096, st_atime=2006/04/20-12:38:27, st_mtime=2006/04/20-12:38:27, st_ctime=2006/04/20-12:38:27}) = 0 stat64("/home/tss/mails/tmp/1145533105.P1098Q0M719016.fe3-mail", 0xafdc8c10) = -1 ENOENT (No such file or directory)
umask(0) = 022
open("/home/tss/mails/tmp/1145533105.P1098Q0M719016.fe3-mail", O_WRONLY|O_CREAT|O_EXCL|O_LARGEFILE, 0600) = 8
umask(022) = 0
_llseek(8, 0, [0], SEEK_CUR) = 0
fstat64(8, {st_dev=makedev(0, 14), st_ino=1152279, st_mode=S_IFREG|0600, st_nlink=1, st_uid=1014, st_gid=1014, st_blksize=32768, st_blocks=0, st_size=0, st_atime=2006/04/20-12:38:30, st_mtime=2006/04/20-12:38:30, st_ctime=2006/04/20-12:38:30}) = 0
write(1, "+ OK\r\n", 6) = 6
read(0, 0x80dfeec, 4076) = -1 EAGAIN (Resource temporarily unavailable)
gettimeofday({1145533105, 732057}, NULL) = 0
poll([{fd=6, events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=0, events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=1, events=POLLOUT|POLLERR|POLLHUP|POLLNVAL, revents=POLLOUT}], 3, 7648) = 1
gettimeofday({1145533105, 732314}, {4294967236, 0}) = 0
gettimeofday({1145533105, 732453}, NULL) = 0
poll([{fd=6, events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=0, events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL, revents=POLLIN}], 2, 7648) = 1
gettimeofday({1145533106, 789242}, {4294967236, 0}) = 0

read(0, "From: foo\n", 4076)            = 10
write(8, "From: foo\n", 10)             = 10
close(8)                                = 0
gettimeofday({1145533106, 790018}, NULL) = 0
poll([{fd=6, events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=0, events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL, revents=POLLIN}], 2, 6590) = 1
gettimeofday({1145533107, 220332}, {4294967236, 0}) = 0
read(0, "\n", 4066)                     = 1
umask(0177)                             = 022
time(NULL)                              = 1145533107

lstat64("/home/tss/mails/dovecot-uidlist.lock", 0xafdc8af0) = -1 ENOENT (No such file or directory)
stat64("/home/tss/mails/temp.fe3-mail.1098.df153002b26a3ab9", 0xafdc8ac0) = -1 ENOENT (No such file or directory)
open("/home/tss/mails/temp.fe3-mail.1098.df153002b26a3ab9", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0666) = 8
link("/home/tss/mails/temp.fe3-mail.1098.df153002b26a3ab9", "/home/tss/mails/dovecot-uidlist.lock") = 0
unlink("/home/tss/mails/temp.fe3-mail.1098.df153002b26a3ab9") = 0
fstat64(8, {st_dev=makedev(0, 14), st_ino=1152280, st_mode=S_IFREG|0600, st_nlink=2, st_uid=1014, st_gid=1014, st_blksize=32768, st_blocks=0, st_size=0, st_atime=2006/04/20-12:38:31, st_mtime=2006/04/20-12:38:31, st_ctime=2006/04/20-12:38:31}) = 0
umask(022) = 0177
open("/home/tss/mails/dovecot-uidlist", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
link("/home/tss/mails/tmp/1145533105.P1098Q0M719016.fe3-mail", "/home/tss/mails/new/1145533105.P1098Q0M719016.fe3-mail") = 0
unlink("/home/tss/mails/tmp/1145533105.P1098Q0M719016.fe3-mail") = 0
write(8, "1 0 2\n1 1145533105.P1098Q0M71901"..., 43) = 43
fstat64(8, {st_dev=makedev(0, 14), st_ino=1152280, st_mode=S_IFREG|0600, st_nlink=2, st_uid=1014, st_gid=1014, st_blksize=32768, st_blocks=0, st_size=43, st_atime=2006/04/20-12:38:31, st_mtime=2006/04/20-12:38:31, st_ctime=2006/04/20-12:38:31}) = 0 utime("/home/tss/mails/dovecot-uidlist.lock", [2006/04/20-12:38:27, 2006/04/20-12:38:27]) = 0
stat64("/home/tss/mails/dovecot-uidlist.lock", {st_dev=makedev(0, 14), st_ino=1152280, st_mode=S_IFREG|0600, st_nlink=2, st_uid=1014, st_gid=1014, st_blksize=32768, st_blocks=0, st_size=43, st_atime=2006/04/20-12:38:31, st_mtime=2006/04/20-12:38:27, st_ctime=2006/04/20-12:38:31}) = 0

#1 lore raw
Quoted 16 lines · Timo Sirainen

Attached two straces where in first one stat() right after utime() gives wrong mtime in reply. The second strace has fstat() call added which makes it work properly for some reason (most of the time, but not always).

I tried creating a small test program which did the last steps in the straces, but I couldn't reproduce the problem with it. So I guess some other syscall before those causes it to get confused.

The NFS server's clock seems to be about 4 seconds in different time from the client. I guess that's part of the reason why it's wrong. Linux kernel figures that because utime() doesn't actually change the mtime it doesn't bother updating it? If this is the case, I think it should be changed because the clocks can't be perfectly sychronized, so there's always some possibility for it to break.

Quoted 4 lines

Kernel is from Debian package linux-image-2.6.16-1-686-smp version 2.6.16-7. NFS server is some Netapp, mounted with options rw,noatime,nfsvers=3,proto=udp,rsize=32768,wsize=32768,actimeo=30. Same with actimeo=0. 2.4.20 used to work fine.

...and 2.6.17-rcX should work fine. See the following patch which was merged into 2.6.17-rc1:

http://client.linux-nfs.org/Linux-2.6.x/2.6.16/linux-2.6.16-007-fix_setattr_clobber.dif

Cheers,
Trond