summaryrefslogtreecommitdiff
path: root/libpod/lock/lock.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-02-21 23:11:24 +0100
committerGitHub <noreply@github.com>2019-02-21 23:11:24 +0100
commiteb6243226a08254f15657c3728bb4dd8949ee6cd (patch)
tree25fea4777a578895b9ac0f5f6c2e19860fc2e4bd /libpod/lock/lock.go
parentb4c10790d514538277a937a443219e4310cb057f (diff)
parent19eb72f4206192b22856eef24ce3815eac3d7bda (diff)
downloadpodman-eb6243226a08254f15657c3728bb4dd8949ee6cd.tar.gz
podman-eb6243226a08254f15657c3728bb4dd8949ee6cd.tar.bz2
podman-eb6243226a08254f15657c3728bb4dd8949ee6cd.zip
Merge pull request #2350 from mheon/lock_renumber
Add lock renumbering
Diffstat (limited to 'libpod/lock/lock.go')
-rw-r--r--libpod/lock/lock.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/libpod/lock/lock.go b/libpod/lock/lock.go
index 1f94171fe..d6841646b 100644
--- a/libpod/lock/lock.go
+++ b/libpod/lock/lock.go
@@ -24,6 +24,20 @@ type Manager interface {
// The underlying lock MUST be the same as another other lock with the
// same UUID.
RetrieveLock(id uint32) (Locker, error)
+ // PLEASE READ FULL DESCRIPTION BEFORE USING.
+ // FreeAllLocks frees all allocated locks, in preparation for lock
+ // reallocation.
+ // As this deallocates all presently-held locks, this can be very
+ // dangerous - if there are other processes running that might be
+ // attempting to allocate new locks and free existing locks, we may
+ // encounter races leading to an inconsistent state.
+ // (This is in addition to the fact that FreeAllLocks instantly makes
+ // the state inconsistent simply by using it, and requires a full
+ // lock renumbering to restore consistency!).
+ // In short, this should only be used as part of unit tests, or lock
+ // renumbering, where reasonable guarantees about other processes can be
+ // made.
+ FreeAllLocks() error
}
// Locker is similar to sync.Locker, but provides a method for freeing the lock