Commit 3ab41fc8 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

UnionFs: Update Mtime rather than Ctime in Utimens().

parent abd479fc
......@@ -346,7 +346,7 @@ func (me *UnionFs) Truncate(path string, offset uint64) (code fuse.Status) {
return me.fileSystems[0].Truncate(path, offset)
}
func (me *UnionFs) Utimens(name string, atime uint64, ctime uint64) (code fuse.Status) {
func (me *UnionFs) Utimens(name string, atime uint64, mtime uint64) (code fuse.Status) {
name = stripSlash(name)
r := me.getBranch(name)
......@@ -356,13 +356,13 @@ func (me *UnionFs) Utimens(name string, atime uint64, ctime uint64) (code fuse.S
r.branch = 0
}
if code.Ok() {
code = me.fileSystems[0].Utimens(name, atime, ctime)
code = me.fileSystems[0].Utimens(name, atime, mtime)
}
if code.Ok() {
r.attr.Atime = uint64(atime / 1e9)
r.attr.Atimensec = uint32(atime % 1e9)
r.attr.Ctime = uint64(ctime / 1e9)
r.attr.Ctimensec = uint32(ctime % 1e9)
r.attr.Mtime = uint64(mtime / 1e9)
r.attr.Mtimensec = uint32(mtime % 1e9)
me.branchCache.Set(name, r)
}
return code
......
......@@ -144,7 +144,7 @@ func TestChtimes(t *testing.T) {
CheckSuccess(err)
fi, err := os.Lstat(wd +"/mount/file")
if fi.Atime_ns != 82e9 || fi.Ctime_ns != 83e9 {
if fi.Atime_ns != 82e9 || fi.Mtime_ns != 83e9 {
t.Error("Incorrect timestamp", fi)
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment