From 312a1177e38d310b9dc8a0b4506270d2883ccde9 Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Tue, 5 Jul 2016 19:37:39 +0200 Subject: [PATCH] flatfs: not error out Walk in case of FileNotFound error This is to prevent race that can happen while GCing the repo Walk will build list of files and one of those files can be removed by GC, currently it causes a failure which shouldn't be the case. License: MIT Signed-off-by: Jakub Sztandera --- flatfs/flatfs.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/flatfs/flatfs.go b/flatfs/flatfs.go index 9d957c5..38b86f6 100644 --- a/flatfs/flatfs.go +++ b/flatfs/flatfs.go @@ -313,6 +313,9 @@ func (fs *Datastore) Query(q query.Query) (query.Results, error) { go func() { defer close(reschan) err := filepath.Walk(fs.path, func(path string, info os.FileInfo, err error) error { + if os.IsNotExist(err) { + return nil + } if err != nil { log.Errorf("Walk func in Query got error: %v", err) return err