From 27a1f3ed2b0d71b2eba4fedabc4eeddffe9c22a4 Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Tue, 30 Jun 2020 09:32:36 -0700 Subject: [PATCH] fs: Check if cache root was added (#9945) Fixes #9942 --- cmd/fs-v1.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/fs-v1.go b/cmd/fs-v1.go index 1286117c2..f5e401727 100644 --- a/cmd/fs-v1.go +++ b/cmd/fs-v1.go @@ -280,6 +280,13 @@ func (fs *FSObjects) CrawlAndGetDataUsage(ctx context.Context, bf *bloomFilter, } logger.LogIf(ctx, err) cache.Info.BloomFilter = nil + + if cache.root() == nil { + if intDataUpdateTracker.debug { + logger.Info(color.Green("CrawlAndGetDataUsage:") + " No root added. Adding empty") + } + cache.replace(cache.Info.Name, dataUsageRoot, dataUsageEntry{}) + } if cache.Info.LastUpdate.After(bCache.Info.LastUpdate) { if intDataUpdateTracker.debug { logger.Info(color.Green("CrawlAndGetDataUsage:")+" Saving bucket %q cache with %d entries", b.Name, len(cache.Cache))