From 843c3b6f3bc4d2d60fd2c4dccbf00c10f29c5894 Mon Sep 17 00:00:00 2001 From: Lidong Zhong Date: Fri, 25 Apr 2025 14:24:41 +0800 Subject: [PATCH] Filesystem: fix getting the wrong block device when doing grep If we have such a filesystem structure mounted in our cluster /dev/drbd50 /export/prq/upgrade_emspq xfs /dev/drbd55 /export/prq/upgrade_sharedmsb xfs /dev/drbd1 /export/devAGN/share xfs /dev/drbd5 /export/dev/archivesn1agn xfs When we want to stop the filesystem mounted on /export/dev/archivesn1agn, we probably will get the wrong entry returned here and thus will try to stop the wrong target. --- heartbeat/Filesystem | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heartbeat/Filesystem b/heartbeat/Filesystem index 0c43220df..d10e5a714 100755 --- a/heartbeat/Filesystem +++ b/heartbeat/Filesystem @@ -408,7 +408,7 @@ list_bindmounts() { fi if [ -b "$mount_disk" ]; then - list_mounts | grep "$mount_disk" | grep -v "$match_string" | cut -d"$TAB" -f2 | sort -r + list_mounts | grep -w "$mount_disk" | grep -v "$match_string" | cut -d"$TAB" -f2 | sort -r fi }