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-effor task, and
the failure should not hinder the follow tasks.

The regression is caused by
737bf77#diff-b54af9ffed94a317525bc7609415261b623020d2aa410c124e9fe3b871d2d2bdR918

Longhorn 9168

Signed-off-by: Derek Su <derek.su@suse.com>
  • Loading branch information
derekbit committed Aug 6, 2024
1 parent 36f2524 commit 9042ead
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(err).Warnf("Failed to remove old head %v", oldHead)
}
return
}

Expand Down

0 comments on commit 9042ead

Please sign in to comment.