mirror of
https://github.com/rclone/rclone.git
synced 2025-12-10 21:33:27 +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) {
|
return func(dir string, callback fs.ListRCallback) (err error) {
|
||||||
mu.Lock()
|
mu.Lock()
|
||||||
defer mu.Unlock()
|
|
||||||
if !started {
|
if !started {
|
||||||
dirCtx := filter.SetUseFilter(m.Ctx, f.Features().FilterAware && !includeAll) // make filter-aware backends constrain List
|
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)
|
dirs, dirsErr = walk.NewDirTree(dirCtx, f, m.Dir, includeAll, ci.MaxDepth)
|
||||||
started = true
|
started = true
|
||||||
}
|
}
|
||||||
if dirsErr != nil {
|
if dirsErr != nil {
|
||||||
|
mu.Unlock()
|
||||||
return dirsErr
|
return dirsErr
|
||||||
}
|
}
|
||||||
entries, ok := dirs[dir]
|
entries, ok := dirs[dir]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
mu.Unlock()
|
||||||
return fs.ErrorDirNotFound
|
return fs.ErrorDirNotFound
|
||||||
}
|
}
|
||||||
delete(dirs, dir)
|
delete(dirs, dir)
|
||||||
|
mu.Unlock()
|
||||||
|
|
||||||
// We use a stable sort here just in case there are
|
// We use a stable sort here just in case there are
|
||||||
// duplicates. Assuming the remote delivers the entries in a
|
// duplicates. Assuming the remote delivers the entries in a
|
||||||
|
|||||||
Reference in New Issue
Block a user