diff options
author | Matthew Heon <matthew.heon@pm.me> | 2019-10-14 10:29:54 -0400 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2019-10-14 10:32:15 -0400 |
commit | 0f6b0e8c9ca3bfa944294a0de98869d732988893 (patch) | |
tree | eb93b90e8ae7e0cea863e1f3c7ac18b205f58bd8 /libpod/runtime_volume_linux.go | |
parent | a8993bab7861e2181630a022484d3f55f706a460 (diff) | |
download | podman-0f6b0e8c9ca3bfa944294a0de98869d732988893.tar.gz podman-0f6b0e8c9ca3bfa944294a0de98869d732988893.tar.bz2 podman-0f6b0e8c9ca3bfa944294a0de98869d732988893.zip |
Ensure volumes can be removed when they fail to unmount
Also, ensure that we don't try to mount them without root - it
appears that it can somehow not error and report that mount was
successful when it clearly did not succeed, which can induce this
case.
We reuse the `--force` flag to indicate that a volume should be
removed even after unmount errors. It seems fairly natural to
expect that --force will remove a volume that is otherwise
presenting problems.
Finally, ignore EINVAL on unmount - if the mount point no longer
exists our job is done.
Fixes: #4247
Fixes: #4248
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
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 |