mirror of
https://github.com/rclone/rclone.git
synced 2025-08-09 05:54:43 +02:00
backend/local: skip entries removed concurrently with List() (#5297)
This change fixes the bug described below: if a file is removed while the local backend List() runs, the call will flag an accounting error. The bug manifests itself if local backend is the Sync target due to intrinsic concurrency. The odds to hit this bug depend on --checkers and --transfers. Chunker over local backend is affected even more because updating a composite object with a smaller size content translates into removing chunks on the underlying file system and involves a number of List() calls.
This commit is contained in:
@ -467,6 +467,10 @@ func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err e
|
||||
for _, name := range names {
|
||||
namepath := filepath.Join(fsDirPath, name)
|
||||
fi, fierr := os.Lstat(namepath)
|
||||
if os.IsNotExist(fierr) {
|
||||
// skip entry removed by a concurrent goroutine
|
||||
continue
|
||||
}
|
||||
if fierr != nil {
|
||||
err = errors.Wrapf(err, "failed to read directory %q", namepath)
|
||||
fs.Errorf(dir, "%v", fierr)
|
||||
|
Reference in New Issue
Block a user