From 88f343c2691cf4d119567e15309f0bdd7f1ebd50 Mon Sep 17 00:00:00 2001 From: andyzhangx Date: Thu, 11 May 2023 03:38:11 +0000 Subject: [PATCH] fix: default actimeo option should respect acregmax and acdirmax --- pkg/azurefile/azurefile.go | 9 ++++----- pkg/azurefile/azurefile_test.go | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/pkg/azurefile/azurefile.go b/pkg/azurefile/azurefile.go index b888287019..d378e57833 100644 --- a/pkg/azurefile/azurefile.go +++ b/pkg/azurefile/azurefile.go @@ -435,6 +435,10 @@ func appendDefaultMountOptions(mountOptions []string) []string { included[k] = true } } + // actimeo would set both acregmax and acdirmax, so we only need to check one of them + if strings.Contains(mountOption, "acregmax") || strings.Contains(mountOption, "acdirmax") { + included[actimeo] = true + } } allMountOptions := mountOptions @@ -449,11 +453,6 @@ func appendDefaultMountOptions(mountOptions []string) []string { } } - /* todo: looks like fsGroup is not included in CSI - if !gidFlag && fsGroup != nil { - allMountOptions = append(allMountOptions, fmt.Sprintf("%s=%d", gid, *fsGroup)) - } - */ return allMountOptions } diff --git a/pkg/azurefile/azurefile_test.go b/pkg/azurefile/azurefile_test.go index 0af17c76a7..4503894093 100644 --- a/pkg/azurefile/azurefile_test.go +++ b/pkg/azurefile/azurefile_test.go @@ -138,6 +138,24 @@ func TestAppendDefaultMountOptions(t *testing.T) { mfsymlinks, }, }, + { + options: []string{"acregmax=1"}, + expected: []string{ + "acregmax=1", + fmt.Sprintf("%s=%s", fileMode, defaultFileMode), + fmt.Sprintf("%s=%s", dirMode, defaultDirMode), + mfsymlinks, + }, + }, + { + options: []string{"acdirmax=2"}, + expected: []string{ + "acdirmax=2", + fmt.Sprintf("%s=%s", fileMode, defaultFileMode), + fmt.Sprintf("%s=%s", dirMode, defaultDirMode), + mfsymlinks, + }, + }, { options: []string{mfsymlinks}, expected: []string{