diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-11-09 15:05:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-09 15:05:28 +0100 |
commit | 4f65befc39bcd9d1e1b227e3c5612ecc87a3abae (patch) | |
tree | 6377d85c2f7ca766487e965f3a4e5104c92a21d5 | |
parent | 3ccd999340462a5af62ac145c339d9c251721aec (diff) | |
parent | 72cf3896851aac16c834d6ac9508e1aab281a93e (diff) | |
download | podman-4f65befc39bcd9d1e1b227e3c5612ecc87a3abae.tar.gz podman-4f65befc39bcd9d1e1b227e3c5612ecc87a3abae.tar.bz2 podman-4f65befc39bcd9d1e1b227e3c5612ecc87a3abae.zip |
Merge pull request #12233 from ianw/shm-lock-failure-message
shm_lock: Handle ENOSPC better in AllocateSemaphore
-rw-r--r-- | libpod/lock/shm/shm_lock.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libpod/lock/shm/shm_lock.go b/libpod/lock/shm/shm_lock.go index 322e92a8f..fea02a619 100644 --- a/libpod/lock/shm/shm_lock.go +++ b/libpod/lock/shm/shm_lock.go @@ -130,8 +130,17 @@ func (locks *SHMLocks) AllocateSemaphore() (uint32, error) { // semaphore indexes, and can still return error codes. retCode := C.allocate_semaphore(locks.lockStruct) if retCode < 0 { + var err = syscall.Errno(-1 * retCode) // Negative errno returned - return 0, syscall.Errno(-1 * retCode) + if errors.Is(err, syscall.ENOSPC) { + // ENOSPC expands to "no space left on device". While it is technically true + // that there's no room in the SHM inn for this lock, this tends to send normal people + // down the path of checking disk-space which is not actually their problem. + // Give a clue that it's actually due to num_locks filling up. + var errFull = errors.Errorf("allocation failed; exceeded num_locks (%d)", locks.maxLocks) + return uint32(retCode), errFull + } + return uint32(retCode), syscall.Errno(-1 * retCode) } return uint32(retCode), nil |