Skip to content

Commit

Permalink
fix(replica): best-effort to delete old head disk file
Browse files Browse the repository at this point in the history
The deletion of old head disk file is a best-effort task, and
the failure should not hinder the following tasks.

Longhorn 9168

Signed-off-by: Derek Su <derek.su@suse.com>
(cherry picked from commit 19d3962)
  • Loading branch information
derekbit committed Sep 12, 2024
1 parent 2fabfa4 commit d9d987b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/replica/replica.go
Original file line number Diff line number Diff line change
Expand Up @@ -915,8 +915,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(errRm).Warnf("Failed to remove old head %v", oldHead)
}
return
}

Expand Down

0 comments on commit d9d987b

Please sign in to comment.