From 8e34843eb1786d2782baa5ccdd27b19bb42e2af7 Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Sat, 17 Feb 2018 19:27:00 +0100 Subject: [PATCH] autosnap: do not treat zero fs filter results as fatal --- cmd/autosnap.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/autosnap.go b/cmd/autosnap.go index 86cfbf7..2b35db6 100644 --- a/cmd/autosnap.go +++ b/cmd/autosnap.go @@ -19,7 +19,7 @@ func (a *IntervalAutosnap) filterFilesystems() (fss []*zfs.DatasetPath, stop boo a.task.Enter("filter_filesystems") defer a.task.Finish() fss, err := zfs.ZFSListMapping(a.DatasetFilter) - stop = err != nil || len(fss) == 0 + stop = err != nil if err != nil { a.task.Log().WithError(err).Error("cannot list datasets") } @@ -37,6 +37,10 @@ func (a *IntervalAutosnap) findSyncPoint(fss []*zfs.DatasetPath) (syncPoint time time time.Time } + if len(fss) == 0 { + return time.Now(), nil + } + snaptimes := make([]snapTime, 0, len(fss)) now := time.Now() @@ -132,6 +136,7 @@ func (a *IntervalAutosnap) syncUpRun(ctx context.Context, didSnaps chan struct{} func (a *IntervalAutosnap) Run(ctx context.Context, didSnaps chan struct{}) { if a.syncUpRun(ctx, didSnaps) { + a.task.Log().Error("stoppping autosnap after error in sync up") return }