"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
mount: fix caching of old directories after renaming them
Nick Craig-Wood4cc2a7f34293
diff --git a/cmd/mount/dir.go b/cmd/mount/dir.goindex cf83da13b..f03e3baf6 100644--- a/cmd/mount/dir.go+++ b/cmd/mount/dir.go@@ -181,6 +181,15 @@ func (d *Dir) Remove(ctx context.Context, req *fuse.RemoveRequest) (err error) {return nil}+// Invalidate a leaf in a directory+func (d *Dir) invalidateEntry(dirNode fusefs.Node, leaf string) {+ fs.Debugf(dirNode, "Invalidating %q", leaf)+ err := d.fsys.server.InvalidateEntry(dirNode, leaf)+ if err != nil {+ fs.Debugf(dirNode, "Failed to invalidate %q: %v", leaf, err)+ }+}+// Check interface satisfiedvar _ fusefs.NodeRenamer = (*Dir)(nil)@@ -197,6 +206,13 @@ func (d *Dir) Rename(ctx context.Context, req *fuse.RenameRequest, newDir fusefsreturn translateError(err)}+ // Invalidate the new directory entry so it gets re-read (in+ // the background otherwise we cause a deadlock)+ //+ // See https://github.com/rclone/rclone/issues/4977 for why+ go d.invalidateEntry(newDir, req.NewName)+ //go d.invalidateEntry(d, req.OldName)+return nil}diff --git a/cmd/mount/fs.go b/cmd/mount/fs.goindex 78a99a6fc..5dbd74efe 100644--- a/cmd/mount/fs.go+++ b/cmd/mount/fs.go@@ -20,8 +20,9 @@ import (// FS represents the top level filing systemtype FS struct {*vfs.VFS- f fs.Fs- opt *mountlib.Options+ f fs.Fs+ opt *mountlib.Options+ server *fusefs.Server}// Check interface satisfieddiff --git a/cmd/mount/mount.go b/cmd/mount/mount.goindex 88aac32de..2b42af472 100644--- a/cmd/mount/mount.go+++ b/cmd/mount/mount.go@@ -91,12 +91,12 @@ func mount(VFS *vfs.VFS, mountpoint string, opt *mountlib.Options) (<-chan error}filesys := NewFS(VFS, opt)- server := fusefs.New(c, nil)+ filesys.server = fusefs.New(c, nil)// Serve the mount point in the background returning error to errChanerrChan := make(chan error, 1)go func() {- err := server.Serve(filesys)+ err := filesys.server.Serve(filesys)closeErr := c.Close()if err == nil {err = closeErr