aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-01-12 11:07:39 -0800
committerchrislu <chris.lu@gmail.com>2022-01-12 11:07:39 -0800
commitcaf0a3486b6ef387b7e00234b03dfdd71ba92966 (patch)
treedc42bfdaa4d58786030c79aee88f32bc3fa2d28d
parentadfd54e7c4e183ccffb90a3355d9ede898d0eb06 (diff)
downloadseaweedfs-caf0a3486b6ef387b7e00234b03dfdd71ba92966.tar.xz
seaweedfs-caf0a3486b6ef387b7e00234b03dfdd71ba92966.zip
POSIX: adjust ctime for file truncate
-rw-r--r--weed/filesys/file.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/weed/filesys/file.go b/weed/filesys/file.go
index 2ba9f6509..063c431b0 100644
--- a/weed/filesys/file.go
+++ b/weed/filesys/file.go
@@ -68,6 +68,7 @@ func (file *File) Attr(ctx context.Context, attr *fuse.Attr) (err error) {
glog.V(4).Infof("file Attr %s, open:%v, size: %d", file.fullpath(), file.isOpen, attr.Size)
}
attr.Crtime = time.Unix(entry.Attributes.Crtime, 0)
+ attr.Ctime = time.Unix(entry.Attributes.Mtime, 0)
attr.Mtime = time.Unix(entry.Attributes.Mtime, 0)
attr.Gid = entry.Attributes.Gid
attr.Uid = entry.Attributes.Uid
@@ -141,6 +142,7 @@ func (file *File) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *f
}
entry.Chunks = chunks
}
+ entry.Attributes.Mtime = time.Now().Unix()
entry.Attributes.FileSize = req.Size
file.dirtyMetadata = true
}