From 9016917d1cfb8c8da2e170805376ea568fef7be5 Mon Sep 17 00:00:00 2001 From: beorn7 Date: Mon, 22 Jun 2015 18:12:55 +0200 Subject: [PATCH] Increment dirty counter only if setDirty(true) is called. Currently, we increment the counter even if setDirty(false) is called, which sets the storage clean. --- storage/local/persistence.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/storage/local/persistence.go b/storage/local/persistence.go index 7e1844a68..2e7cdb056 100644 --- a/storage/local/persistence.go +++ b/storage/local/persistence.go @@ -316,7 +316,9 @@ func (p *persistence) isDirty() bool { // dirty during our runtime, there is no way back. If we were dirty from the // start, a clean-up might make us clean again.) func (p *persistence) setDirty(dirty bool) { - p.dirtyCounter.Inc() + if dirty { + p.dirtyCounter.Inc() + } p.dirtyMtx.Lock() defer p.dirtyMtx.Unlock() if p.becameDirty {