mirror of
https://github.com/rclone/rclone.git
synced 2025-12-11 22:14:05 +01:00
mount, cmount: add --attr-timeout to control attribute caching in kernel
This flag allows the attribute caching in the kernel to be controlled. The default is 0s - no caching - which is recommended for filesystems which can change outside the control of the kernel. Previously this was at the default meaning it was 60s for mount and 1s for cmount. This showed strange effects when files changed on the remote not via the kernel. For instance Caddy would serve corrupted files for a while when serving from an rclone mount when a file changed on the remote.
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
|
||||
"bazil.org/fuse"
|
||||
fusefs "bazil.org/fuse/fs"
|
||||
"github.com/ncw/rclone/cmd/mountlib"
|
||||
"github.com/ncw/rclone/fs/log"
|
||||
"github.com/ncw/rclone/vfs"
|
||||
"golang.org/x/net/context"
|
||||
@@ -24,6 +25,7 @@ var _ fusefs.Node = (*File)(nil)
|
||||
// Attr fills out the attributes for the file
|
||||
func (f *File) Attr(ctx context.Context, a *fuse.Attr) (err error) {
|
||||
defer log.Trace(f, "")("a=%+v, err=%v", a, &err)
|
||||
a.Valid = mountlib.AttrTimeout
|
||||
modTime := f.File.ModTime()
|
||||
Size := uint64(f.File.Size())
|
||||
Blocks := (Size + 511) / 512
|
||||
|
||||
Reference in New Issue
Block a user