mirror of
https://github.com/rclone/rclone.git
synced 2025-01-09 15:58:28 +01:00
vfs: Fix a race condition in retryFailedResets
A failed item reset is saved in the errItems for retryFailedResets to process. If the item gets closed before the retry, the item may have been removed from the c.item array. Previous code did not account for this condition. This patch adds the check for the exitence of the retry items in retryFailedResets.
This commit is contained in:
parent
5f1d5a1897
commit
64d736a57b
@ -467,11 +467,17 @@ func (c *Cache) retryFailedResets() {
|
||||
if len(c.errItems) != 0 {
|
||||
fs.Debugf(nil, "vfs cache reset: before redoing reset errItems = %v", c.errItems)
|
||||
for itemName := range c.errItems {
|
||||
_, _, err := c.item[itemName].Reset()
|
||||
if retryItem, ok := c.item[itemName]; ok {
|
||||
_, _, err := retryItem.Reset()
|
||||
if err == nil || !fserrors.IsErrNoSpace(err) {
|
||||
// TODO: not trying to handle non-ENOSPC errors yet
|
||||
delete(c.errItems, itemName)
|
||||
}
|
||||
} else {
|
||||
// The retry item was deleted because it was closed.
|
||||
// No need to redo the failed reset now.
|
||||
delete(c.errItems, itemName)
|
||||
}
|
||||
}
|
||||
fs.Debugf(nil, "vfs cache reset: after redoing reset errItems = %v", c.errItems)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user