From 9042ead736e17e09509575ae6520c5879974a3fe Mon Sep 17 00:00:00 2001 From: Derek Su Date: Tue, 6 Aug 2024 14:33:07 +0800 Subject: [PATCH] fix(replica): best-effort to delete old head disk file The deletion of old head disk file is a best-effor task, and the failure should not hinder the follow tasks. The regression is caused by https://github.com/longhorn/longhorn-engine/commit/737bf77b6e0f01e68dbb340e4b3421bb0c7417b6#diff-b54af9ffed94a317525bc7609415261b623020d2aa410c124e9fe3b871d2d2bdR918 Longhorn 9168 Signed-off-by: Derek Su --- pkg/replica/replica.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/replica/replica.go b/pkg/replica/replica.go index 815b9bbcd..dd25f8913 100644 --- a/pkg/replica/replica.go +++ b/pkg/replica/replica.go @@ -920,8 +920,9 @@ func (r *Replica) createDisk(name string, userCreated bool, created string, labe rollbackFuncList := []func() error{} defer func() { if err == nil { - err = r.rmDisk(oldHead) - logrus.WithError(err).Errorf("Failed to remove old head %v", oldHead) + if errRm := r.rmDisk(oldHead); errRm != nil { + logrus.WithError(err).Warnf("Failed to remove old head %v", oldHead) + } return }