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>
  • Loading branch information
derekbit authored and mergify[bot] committed Aug 6, 2024
1 parent 36f2524 commit 19d3962
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 @@ -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(errRm).Warnf("Failed to remove old head %v", oldHead)
}
return
}

Expand Down

0 comments on commit 19d3962

Please sign in to comment.