mirror of
https://github.com/versity/scoutfs.git
synced 2026-02-05 10:10:42 +00:00
This adds the fenced scripts so that we have a place to track these and get updates out to users. This latest version of scripts has the checks to validate that power off succeeded and not just assume based on power command return status. Signed-off-by: Ben McClelland <ben.mcclelland@versity.com>
37 lines
847 B
Bash
37 lines
847 B
Bash
#!/usr/bin/bash
|
|
# /usr/libexec/scoutfs-fenced/run/local-force-umount
|
|
|
|
echo_fail() {
|
|
echo "$@" > /dev/stderr
|
|
exit 1
|
|
}
|
|
|
|
rid="$SCOUTFS_FENCED_REQ_RID"
|
|
|
|
#
|
|
# Look for a local mount with the rid to fence. Typically we'll at
|
|
# least find the mount with the server that requested the fence that
|
|
# we're processing. But it's possible that mounts are unmounted
|
|
# before, or while, we're running.
|
|
#
|
|
mnts=$(findmnt -l -n -t scoutfs -o TARGET) || \
|
|
echo_fail "findmnt -t scoutfs failed" > /dev/stderr
|
|
|
|
for mnt in $mnts; do
|
|
mnt_rid=$(scoutfs statfs -p "$mnt" -s rid) || \
|
|
echo_fail "scoutfs statfs $mnt failed"
|
|
|
|
if [ "$mnt_rid" == "$rid" ]; then
|
|
umount -f "$mnt" || \
|
|
echo_fail "umout -f $mnt"
|
|
|
|
exit 0
|
|
fi
|
|
done
|
|
|
|
#
|
|
# If the mount doesn't exist on this host then it can't access the
|
|
# devices by definition and can be considered fenced.
|
|
#
|
|
exit 0
|