Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

vfs: fix modtime changing when reading file into cache - fixes #5277

Nick Craig-Wood00a0ee189959
diff --git a/vfs/vfscache/cache.go b/vfs/vfscache/cache.go
index 3a3cf2bc6..7427e9d0e 100644
--- a/vfs/vfscache/cache.go
+++ b/vfs/vfscache/cache.go
@@ -549,7 +549,7 @@ func (c *Cache) purgeClean(quota int64) {
// Make a slice of clean cache files
for _, item := range c.item {
- if !item.IsDataDirty() {
+ if !item.IsDirty() {
items = append(items, item)
}
}
diff --git a/vfs/vfscache/item.go b/vfs/vfscache/item.go
index 7c42563c8..1d07c57ff 100644
--- a/vfs/vfscache/item.go
+++ b/vfs/vfscache/item.go
@@ -450,15 +450,8 @@ func (item *Item) Dirty() {
item.mu.Unlock()
}
-// IsDirty returns true if the item is dirty
+// IsDirty returns true if the item data is dirty
func (item *Item) IsDirty() bool {
- item.mu.Lock()
- defer item.mu.Unlock()
- return item.metaDirty || item.info.Dirty
-}
-
-// IsDataDirty returns true if the item's data is dirty
-func (item *Item) IsDataDirty() bool {
item.mu.Lock()
defer item.mu.Unlock()
return item.info.Dirty