From 8bb2f83cf9d4e121cd05c921eeaf235786a956a0 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Mon, 17 Nov 2025 15:57:24 -0800 Subject: [PATCH] Findmnt returns 1 when no matching entries found Our local fence script attempts to interpret errors executing `findmnt` as critical errors, but the program exit code explicitly returns EXIT_FAILURE when the total number of matching mount entries is zero. This can happen if the mount disappeared while we're attempting to fence the mount, but, the scoutfs sysfs files are still in place as we read them. It's a small window, but, it's a fork/exec plus full parse of /etc/fstab, and a lot can happen in the 0.015s findmnt takes on my system. There's no other exit codes from findmnt other than 0 and 1. At that point, we can only assume that if the stdout is empty, the mount isn't there anymore. Signed-off-by: Auke Kok --- tests/fenced-local-force-unmount.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/fenced-local-force-unmount.sh b/tests/fenced-local-force-unmount.sh index cf879b85..f725e78b 100755 --- a/tests/fenced-local-force-unmount.sh +++ b/tests/fenced-local-force-unmount.sh @@ -27,8 +27,7 @@ for fs in /sys/fs/scoutfs/*; do nr="$(quiet_cat $fs/data_device_maj_min)" [ ! -d "$fs" -o "$fs_rid" != "$rid" ] && continue - mnt=$(findmnt -l -n -t scoutfs -o TARGET -S $nr) || \ - echo_fail "findmnt -t scoutfs -S $nr failed" + mnt=$(findmnt -l -n -t scoutfs -o TARGET -S $nr) [ -z "$mnt" ] && continue if ! umount -qf "$mnt"; then