fs/cache: unlock mutex in cache.Get to allow recursive calls

This fixes the test lockup in the union tests
This commit is contained in:
Nick Craig-Wood 2019-06-15 10:42:53 +01:00
parent d2be792d5e
commit f3719fe269

2
fs/cache/cache.go vendored
View File

@ -30,7 +30,9 @@ func Get(fsString string) (f fs.Fs, err error) {
defer fsCacheMu.Unlock() defer fsCacheMu.Unlock()
entry, ok := fsCache[fsString] entry, ok := fsCache[fsString]
if !ok { if !ok {
fsCacheMu.Unlock() // Unlock in case Get is called recursively
f, err = fsNewFs(fsString) f, err = fsNewFs(fsString)
fsCacheMu.Lock()
if err != nil && err != fs.ErrorIsFile { if err != nil && err != fs.ErrorIsFile {
return f, err return f, err
} }