Skip to content

Commit

Permalink
umount when volume is broken
Browse files Browse the repository at this point in the history
  • Loading branch information
hervenicol committed Jul 19, 2021
1 parent 7959a44 commit 62011b6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## v0.8.0
* fix did not umount when volume is broken

## v0.7.0

* fix label too long errors at mkfs
Expand Down
6 changes: 4 additions & 2 deletions plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,9 @@ func (d plugin) Unmount(r *volume.UnmountRequest) error {
logger.WithError(err).Errorf("Error checking directory stat: %s", path)
}

if exists {
// error with "stats" usually means it exists but we can't reach it
// that means mounted but broken. So we must unmount it.
if exists || (err != nil) {
err = syscall.Unmount(path, 0)
if err != nil {
logger.WithError(err).Errorf("Error unmount %s", path)
Expand All @@ -407,7 +409,7 @@ func (d plugin) Unmount(r *volume.UnmountRequest) error {

vol, err := d.getByName(r.Name)
if err != nil {
logger.WithError(err).Error("Error retriving volume")
logger.WithError(err).Error("Error retrieving volume")
} else {
_, err = d.detachVolume(logger.Context, vol)
if err != nil {
Expand Down

0 comments on commit 62011b6

Please sign in to comment.