system locks now reports held locks

To debug a deadlock, we really want to know what lock is actually
locked, so we can figure out what is using that lock. This PR
adds support for this, using trylock to check if every lock on
the system is free or in use. Will really need to be run a few
times in quick succession to verify that it's not a transient
lock and it's actually stuck, but that's not really a big deal.

Signed-off-by: Matt Heon <mheon@redhat.com>
This commit is contained in:
Matt Heon
2023-06-05 15:45:59 -04:00
parent 0948c078c2
commit 4fda7936c5
14 changed files with 178 additions and 26 deletions

View File

@ -108,6 +108,10 @@ func (m *SHMLockManager) AvailableLocks() (*uint32, error) {
return &avail, nil
}
func (m *SHMLockManager) LocksHeld() ([]uint32, error) {
return m.locks.GetTakenLocks()
}
// SHMLock is an individual shared memory lock.
type SHMLock struct {
lockID uint32