From eccf8784c87a47187d42c4eb763aca7aa66a5290 Mon Sep 17 00:00:00 2001 From: Weiwei Date: Tue, 14 Mar 2023 21:05:02 +0800 Subject: [PATCH] update mount to check mountinfo (#2739) Signed-off-by: zwwhdls --- csi/shell/check_bind_mounts.sh | 2 +- csi/shell/check_mount.sh | 2 +- pkg/scripts/poststart/check_fuse.go | 2 +- pkg/scripts/poststart/check_fuse_app.go | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/csi/shell/check_bind_mounts.sh b/csi/shell/check_bind_mounts.sh index 9a654959322..05ac572d319 100644 --- a/csi/shell/check_bind_mounts.sh +++ b/csi/shell/check_bind_mounts.sh @@ -6,4 +6,4 @@ VolumeName="$1" MountPattern="pods/.*/volumes/kubernetes\.io~csi/$VolumeName/mount" -mount | grep $MountPattern +cat /proc/self/mountinfo | grep $MountPattern diff --git a/csi/shell/check_mount.sh b/csi/shell/check_mount.sh index 0b01cfd7726..fba9e0b94e0 100644 --- a/csi/shell/check_mount.sh +++ b/csi/shell/check_mount.sh @@ -10,7 +10,7 @@ SubPath="$3" count=0 # while ! mount | grep alluxio | grep $ConditionPathIsMountPoint | grep -v grep -while ! mount | grep $ConditionPathIsMountPoint | grep $MountType +while ! cat /proc/self/mountinfo | grep $ConditionPathIsMountPoint | grep $MountType do sleep 3 count=`expr $count + 1` diff --git a/pkg/scripts/poststart/check_fuse.go b/pkg/scripts/poststart/check_fuse.go index 8549df1303f..baf796f7bb7 100644 --- a/pkg/scripts/poststart/check_fuse.go +++ b/pkg/scripts/poststart/check_fuse.go @@ -47,7 +47,7 @@ SubPath="$3" count=0 # while ! mount | grep alluxio | grep $ConditionPathIsMountPoint | grep -v grep -while ! mount | grep $ConditionPathIsMountPoint | grep $MountType +while ! cat /proc/self/mountinfo | grep $ConditionPathIsMountPoint | grep $MountType do sleep 3 count=¬expr $count + 1¬ diff --git a/pkg/scripts/poststart/check_fuse_app.go b/pkg/scripts/poststart/check_fuse_app.go index e02d362628c..0e5664f89fc 100644 --- a/pkg/scripts/poststart/check_fuse_app.go +++ b/pkg/scripts/poststart/check_fuse_app.go @@ -18,6 +18,7 @@ package poststart import ( "fmt" + corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" utilpointer "k8s.io/utils/pointer" @@ -53,7 +54,7 @@ for idx in "${!mountPaths[@]}"; do mp=${mountPaths[$idx]} mt=${mountTypes[$idx]} count=0 - while ! mount | grep $mp | grep $mt + while ! cat /proc/self/mountinfo | grep $mp | grep $mt do sleep 3 count=¬expr $count + 1¬