diff options
Diffstat (limited to 'libpod/runtime_renumber.go')
-rw-r--r-- | libpod/runtime_renumber.go | 29 |
1 files changed, 3 insertions, 26 deletions
diff --git a/libpod/runtime_renumber.go b/libpod/runtime_renumber.go index d5279934e..04abc84d1 100644 --- a/libpod/runtime_renumber.go +++ b/libpod/runtime_renumber.go @@ -1,14 +1,11 @@ package libpod import ( - "path/filepath" - - "github.com/containers/storage" "github.com/pkg/errors" ) -// RenumberLocks reassigns lock numbers for all containers, pods, and volumes in -// the state. +// renumberLocks reassigns lock numbers for all containers and pods in the +// state. // It renders the runtime it is called on, and all container/pod/volume structs // from that runtime, unusable, and requires that a new runtime be initialized // after it is called. @@ -18,24 +15,7 @@ import ( // lock as read, renumber attempting to take a write lock? // The alternative is some sort of session tracking, and I don't know how // reliable that can be. -func (r *Runtime) RenumberLocks() error { - r.lock.Lock() - locked := true - defer func() { - if locked { - r.lock.Unlock() - } - }() - - runtimeAliveLock := filepath.Join(r.config.TmpDir, "alive.lck") - aliveLock, err := storage.GetLockfile(runtimeAliveLock) - if err != nil { - return errors.Wrapf(err, "error acquiring runtime init lock") - } - aliveLock.Lock() - // It's OK to defer until Shutdown() has run, so no need to check locked - defer aliveLock.Unlock() - +func (r *Runtime) renumberLocks() error { // Start off by deallocating all locks if err := r.lockManager.FreeAllLocks(); err != nil { return err @@ -76,8 +56,5 @@ func (r *Runtime) RenumberLocks() error { } } - r.lock.Unlock() - locked = false - return r.Shutdown(false) } |