Skip to content

Commit

Permalink
fixed data race in flag propagation
Browse files Browse the repository at this point in the history
  • Loading branch information
dundee committed Feb 16, 2021
1 parent 629c9cc commit 3d47ab6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
9 changes: 0 additions & 9 deletions analyze/dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,7 @@ func processDir(path string, progress *CurrentProgress, concurrencyLimitChannel
subdir.Parent = &dir

mutex.Lock()

dir.Files = append(dir.Files, subdir)

switch subdir.Flag {
case '!', '.':
if dir.Flag != '!' {
dir.Flag = '.'
}
}

mutex.Unlock()

<-concurrencyLimitChannel
Expand Down
7 changes: 7 additions & 0 deletions analyze/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ func (f *File) UpdateStats(links AlreadyCountedHardlinks) {
entry.UpdateStats(links)
}

switch entry.Flag {
case '!', '.':
if f.Flag != '!' {
f.Flag = '.'
}
}

itemCount += entry.ItemCount

if entry.MutliLinkInode > 0 {
Expand Down

0 comments on commit 3d47ab6

Please sign in to comment.