Skip to content

Commit

Permalink
Fix memory clearing in adder
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
  • Loading branch information
whyrusleeping committed Dec 20, 2017
1 parent 5ad9f4d commit 7616a59
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion core/coreunix/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,9 +443,24 @@ func (adder *Adder) addFile(file files.File) error {
if err != nil {
return err
}
if err := mr.Flush(); err != nil {
dir, ok := mr.GetValue().(*mfs.Directory)
if !ok {
return fmt.Errorf("invalid mfs structure, root should be a directory")
}

if err := dir.Flush(); err != nil {
return err
}

names, err := dir.ListNames(adder.ctx)
if err != nil {
return err
}

for _, name := range names {
dir.Uncache(name)
}

adder.liveNodes = 0
}
adder.liveNodes++
Expand Down

0 comments on commit 7616a59

Please sign in to comment.