aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2010-03-18 18:07:39 -0700
committerRuss Cox <rsc@swtch.com>2010-03-18 18:07:39 -0700
commitbe856b940fb5abb22abe649256bb4283c07c3d85 (patch)
treea721c036d11b4f01125a346b0ae843bdf6bc1a71 /src
parent1619f52cbc2096dd2fc93b189890bc8fd0771681 (diff)
downloadplan9port-be856b940fb5abb22abe649256bb4283c07c3d85.tar.gz
plan9port-be856b940fb5abb22abe649256bb4283c07c3d85.tar.bz2
plan9port-be856b940fb5abb22abe649256bb4283c07c3d85.zip
acme: attempt to fix Put mtime skew on NFS
R=r http://codereview.appspot.com/583043
Diffstat (limited to 'src')
-rw-r--r--src/cmd/acme/exec.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/cmd/acme/exec.c b/src/cmd/acme/exec.c
index d24775df..a71b5b48 100644
--- a/src/cmd/acme/exec.c
+++ b/src/cmd/acme/exec.c
@@ -687,6 +687,19 @@ putfile(File *f, int q0, int q1, Rune *namer, int nname)
w->dirty = TRUE;
f->unread = TRUE;
}else{
+ // In case the file is on NFS, reopen the fd
+ // before dirfstat to cause the attribute cache
+ // to be updated (otherwise the mtime in the
+ // dirfstat below will be stale and not match
+ // what NFS sees). The file is already written,
+ // so this should be a no-op when not on NFS.
+ // Opening for OWRITE (but no truncation)
+ // in case we don't have read permission.
+ // (The create above worked, so we probably
+ // still have write permission.)
+ close(fd);
+ fd = open(name, OWRITE);
+
d1 = dirfstat(fd);
if(d1 != nil){
free(d);