"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
vfs: Ignore ECLOSED in Setattr when truncating file handles
Nick Craig-Wood0902e5c48e21
diff --git a/vfs/file.go b/vfs/file.goindex e30d85692..d890b1f54 100644--- a/vfs/file.go+++ b/vfs/file.go@@ -746,18 +746,23 @@ func (f *File) Truncate(size int64) (err error) {copy(writers, f.writers)f.mu.Unlock()- // FIXME: handle closing writer-// If have writers then call truncate for each writerif len(writers) != 0 {+ var openWriters = len(writers)fs.Debugf(f.Path(), "Truncating %d file handles", len(writers))for _, h := range writers {truncateErr := h.Truncate(size)- if truncateErr != nil {+ if truncateErr == ECLOSED {+ // Ignore ECLOSED since file handle can get closed while this is running+ openWriters--+ } else if truncateErr != nil {err = truncateErr}}- return err+ // If at least one open writer return here+ if openWriters > 0 {+ return err+ }}// if o is nil it isn't valid yet