diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-12-02 23:32:59 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-02 23:32:59 -0800 |
commit | 309452dcfc4bea9cbeff03c8b7c9a0811521e524 (patch) | |
tree | b7e96d6c4940f67c0c595153b7e18b7f9b91e07b /libpod/volume_internal.go | |
parent | 6458f960e6cc841e9a0afc078ba76b3090174c57 (diff) | |
parent | 689329f7495c1fc4f035fe3f39be28375987faf8 (diff) | |
download | podman-309452dcfc4bea9cbeff03c8b7c9a0811521e524.tar.gz podman-309452dcfc4bea9cbeff03c8b7c9a0811521e524.tar.bz2 podman-309452dcfc4bea9cbeff03c8b7c9a0811521e524.zip |
Merge pull request #4624 from mheon/refresh_volume_locks
Ensure volumes reacquire locks on state refresh
Diffstat (limited to 'libpod/volume_internal.go')
-rw-r--r-- | libpod/volume_internal.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libpod/volume_internal.go b/libpod/volume_internal.go index 42b935e7c..e89b3484d 100644 --- a/libpod/volume_internal.go +++ b/libpod/volume_internal.go @@ -5,6 +5,7 @@ import ( "path/filepath" "github.com/containers/libpod/libpod/define" + "github.com/pkg/errors" ) // Creates a new volume @@ -46,3 +47,14 @@ func (v *Volume) update() error { func (v *Volume) save() error { return v.runtime.state.SaveVolume(v) } + +// Refresh volume state after a restart. +func (v *Volume) refresh() error { + lock, err := v.runtime.lockManager.AllocateAndRetrieveLock(v.config.LockID) + if err != nil { + return errors.Wrapf(err, "error acquiring lock %d for volume %s", v.config.LockID, v.Name()) + } + v.lock = lock + + return nil +} |