mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-23 02:48:14 +00:00
The controller mount of DIR_VAR_LIB survived the teardown, so the next distro cycle inherited an NFS session whose server container was already gone: the kernel logged 'server not responding, timed out' and every access under /var/lib/infinito wedged, taking the deploy down with it. All five swarm jobs of the last manual run died this way, each on a different distro but always on the third lab cycle. Both halves of the old teardown were unable to clear it. The guard `mountpoint -q` blocks on exactly the dead mount it is asked about, so the timeout dropped the unmount that was needed; and `umount -lf` ran without sudo on a non-root runner, so the EPERM went into `|| true`. Detection now reads /proc/self/mountinfo, which touches no filesystem, the unmount elevates when the caller is not root, and a mount that survives all of it fails loudly instead of silently poisoning the next cycle. The bootstrap runs the same release before bringing a lab up, so a cycle whose teardown never ran cannot hand the mount on either. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
35 lines
849 B
Bash
Executable File
35 lines
849 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# shellcheck shell=bash
|
|
#
|
|
# Release the host-side NFS mount of the cluster-shared infinito state.
|
|
#
|
|
# `mountpoint` and `findmnt --mountpoint` block on a mount whose NFS server is
|
|
# gone, which is exactly the case this has to clean up, so detection reads
|
|
# /proc/self/mountinfo instead.
|
|
#
|
|
# Param:
|
|
# $1 mount point of the shared state (DIR_VAR_LIB)
|
|
|
|
set -u
|
|
|
|
mount_point="${1:?mount point required}"
|
|
|
|
mounted() {
|
|
grep -qF " ${mount_point} " /proc/self/mountinfo
|
|
}
|
|
|
|
mounted || exit 0
|
|
|
|
umount_cmd=(timeout 30 umount -lf "${mount_point}")
|
|
if [ "$(id -u)" -ne 0 ]; then
|
|
umount_cmd=(sudo -n "${umount_cmd[@]}")
|
|
fi
|
|
|
|
echo ">>> releasing host NFS mount at ${mount_point}"
|
|
"${umount_cmd[@]}" 2>/dev/null
|
|
|
|
if mounted; then
|
|
echo "FAILURE: ${mount_point} is still mounted; the next drill would inherit a stale NFS handle" >&2
|
|
exit 1
|
|
fi
|