mirror of
https://github.com/rclone/rclone.git
synced 2025-12-06 00:03:32 +00:00
march: fix deadlock when using --fast-list on syncs - fixes #8811
Before this change, it was possible to have a deadlock when using --fast-list for a sync if both the source and destination supported ListR. This fixes the problem by shortening the locking window.
This commit is contained in:
@@ -137,20 +137,22 @@ func (m *March) makeListDir(ctx context.Context, f fs.Fs, includeAll bool, keyFn
|
||||
)
|
||||
return func(dir string, callback fs.ListRCallback) (err error) {
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
if !started {
|
||||
dirCtx := filter.SetUseFilter(m.Ctx, f.Features().FilterAware && !includeAll) // make filter-aware backends constrain List
|
||||
dirs, dirsErr = walk.NewDirTree(dirCtx, f, m.Dir, includeAll, ci.MaxDepth)
|
||||
started = true
|
||||
}
|
||||
if dirsErr != nil {
|
||||
mu.Unlock()
|
||||
return dirsErr
|
||||
}
|
||||
entries, ok := dirs[dir]
|
||||
if !ok {
|
||||
mu.Unlock()
|
||||
return fs.ErrorDirNotFound
|
||||
}
|
||||
delete(dirs, dir)
|
||||
mu.Unlock()
|
||||
|
||||
// We use a stable sort here just in case there are
|
||||
// duplicates. Assuming the remote delivers the entries in a
|
||||
|
||||
Reference in New Issue
Block a user