|
|
|
@ -307,16 +307,18 @@ func (fs *FileSystemObject) FetchFile(client *Client, fd *os.File, stat os.FileI
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Try upgrade our lock, else error out
|
|
|
|
|
// Try upgrade our lock, else error out (have to remember to unlock!!)
|
|
|
|
|
if !fs.UpgradeLock() {
|
|
|
|
|
fs.Unlock()
|
|
|
|
|
return NewError(MutexUpgradeErr)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Put file in cache
|
|
|
|
|
fs.cache.Put(p.Absolute(), f)
|
|
|
|
|
|
|
|
|
|
// Try downgrade our lock, else error out
|
|
|
|
|
// Try downgrade our lock, else error out (have to remember to runlock!!)
|
|
|
|
|
if !fs.DowngradeLock() {
|
|
|
|
|
fs.RUnlock()
|
|
|
|
|
return NewError(MutexDowngradeErr)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -328,8 +330,9 @@ func (fs *FileSystemObject) FetchFile(client *Client, fd *os.File, stat os.FileI
|
|
|
|
|
|
|
|
|
|
// Check for file freshness
|
|
|
|
|
if !f.IsFresh() {
|
|
|
|
|
// Try upgrade file lock, else error out
|
|
|
|
|
// Try upgrade file lock, else error out (have to remember to unlock!!)
|
|
|
|
|
if !f.UpgradeLock() {
|
|
|
|
|
f.Unlock()
|
|
|
|
|
return NewError(MutexUpgradeErr)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -341,8 +344,9 @@ func (fs *FileSystemObject) FetchFile(client *Client, fd *os.File, stat os.FileI
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Try downgrade file lock, else error out
|
|
|
|
|
// Try downgrade file lock, else error out (have to remember to runlock!!)
|
|
|
|
|
if !f.DowngradeLock() {
|
|
|
|
|
f.RUnlock()
|
|
|
|
|
return NewError(MutexDowngradeErr)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|