1
0
mirror of https://github.com/rclone/rclone.git synced 2025-12-06 00:03:32 +00:00

vfs: stop reading Dir members from outside dir.go

This commit is contained in:
Nick Craig-Wood
2020-04-14 18:14:24 +01:00
parent 238f26cc90
commit 19db0df639
4 changed files with 54 additions and 35 deletions

View File

@@ -305,21 +305,7 @@ func (vfs *VFS) WaitForWriters(timeout time.Duration) {
defer tick.Stop()
tick.Stop()
for {
writers := 0
vfs.root.walk(func(d *Dir) {
fs.Debugf(d.path, "Looking for writers")
// NB d.mu is held by walk() here
for leaf, item := range d.items {
fs.Debugf(leaf, "reading active writers")
if file, ok := item.(*File); ok {
n := file.activeWriters()
if n != 0 {
fs.Debugf(file, "active writers %d", n)
}
writers += n
}
}
})
writers := vfs.root.countActiveWriters()
if writers == 0 {
return
}