vfs: Only make the VFS cache if --vfs-cache-mode > Off

This stops the cache cleaner running unnecessarily and saves
resources.

This also helps with issue #2227 which was caused by a second mount
deleting objects in the first mounts cache.
This commit is contained in:
Nick Craig-Wood
2018-04-16 16:38:32 +01:00
parent 3d5106e52b
commit 2b7957cc74
4 changed files with 33 additions and 18 deletions

View File

@@ -481,8 +481,7 @@ func (f *File) Open(flags int) (fd Handle, err error) {
// Open the correct sort of handle
CacheMode := f.d.vfs.Opt.CacheMode
opens := f.d.vfs.cache.opens(f.Path())
if CacheMode >= CacheModeMinimal && opens > 0 {
if CacheMode >= CacheModeMinimal && f.d.vfs.cache.opens(f.Path()) > 0 {
fd, err = f.openRW(flags)
} else if read && write {
if CacheMode >= CacheModeMinimal {