commit be856b940fb5abb22abe649256bb4283c07c3d85 from: Russ Cox date: Fri Mar 19 01:07:39 2010 UTC acme: attempt to fix Put mtime skew on NFS R=r http://codereview.appspot.com/583043 commit - 1619f52cbc2096dd2fc93b189890bc8fd0771681 commit + be856b940fb5abb22abe649256bb4283c07c3d85 blob - d24775df31dc17eadd2557ac4bdc8903e9474330 blob + a71b5b4853d576497a1b997b9f47a0d5b38f91ff --- src/cmd/acme/exec.c +++ src/cmd/acme/exec.c @@ -687,6 +687,19 @@ putfile(File *f, int q0, int q1, Rune *namer, int nnam 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);