diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-10-16 10:20:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-16 10:20:27 +0200 |
commit | 1137c1084b960c9d186cdf8276121658c33a1a56 (patch) | |
tree | a62cd88fd3415fd05e87d6ad3cdbbb5f36723ff7 /libpod/runtime_volume_linux.go | |
parent | 5f72e6ef2ef7b6941cefc3c655903aeacb53e115 (diff) | |
parent | 0f6b0e8c9ca3bfa944294a0de98869d732988893 (diff) | |
download | podman-1137c1084b960c9d186cdf8276121658c33a1a56.tar.gz podman-1137c1084b960c9d186cdf8276121658c33a1a56.tar.bz2 podman-1137c1084b960c9d186cdf8276121658c33a1a56.zip |
Merge pull request #4256 from mheon/fix_volumes
Ensure volumes can be removed when they fail to unmount
Diffstat (limited to 'libpod/runtime_volume_linux.go')
-rw-r--r-- | libpod/runtime_volume_linux.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libpod/runtime_volume_linux.go b/libpod/runtime_volume_linux.go index 9df93faf3..ba4fff4be 100644 --- a/libpod/runtime_volume_linux.go +++ b/libpod/runtime_volume_linux.go @@ -157,7 +157,14 @@ func (r *Runtime) removeVolume(ctx context.Context, v *Volume, force bool) error // If the volume is still mounted - force unmount it if err := v.unmount(true); err != nil { - return errors.Wrapf(err, "error unmounting volume %s", v.Name()) + if force { + // If force is set, evict the volume, even if errors + // occur. Otherwise we'll never be able to get rid of + // them. + logrus.Errorf("Error unmounting volume %s: %v", v.Name(), err) + } else { + return errors.Wrapf(err, "error unmounting volume %s", v.Name()) + } } // Set volume as invalid so it can no longer be used |