mirror of
https://github.com/rclone/rclone.git
synced 2026-01-06 02:23:24 +00:00
vfs: fix modtime set if --vfs-cache-mode writes/full and no write
When using --vfs-cache-mode writes or full if a file was opened for write intent, the modtime was set and the file was closed without being modified the modtime would never be written back to storage. The sequence of events - app opens file with write intent - app does set modtime - rclone sets the modtime on the cache file, but not the remote file because it is open for write and can't be set yet - app closes the file without changing it - rclone doesn't upload the file because the file wasn't changed so the modtime doesn't get updated This fixes the problem by making sure any unapplied modtime changes are applied even if the file is not modified when being closed. Fixes #4795
This commit is contained in:
@@ -424,6 +424,13 @@ func (f *File) _applyPendingModTime() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Apply a pending mod time
|
||||
func (f *File) applyPendingModTime() error {
|
||||
f.mu.Lock()
|
||||
defer f.mu.Unlock()
|
||||
return f._applyPendingModTime()
|
||||
}
|
||||
|
||||
// _writingInProgress returns true of there are any open writers
|
||||
// Call with read lock held
|
||||
func (f *File) _writingInProgress() bool {
|
||||
|
||||
Reference in New Issue
Block a user