Skip to content

Commit d338db8

Browse files
committed
fix: avoid using different mount path in remount
fix ut
1 parent 1c04b45 commit d338db8

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

pkg/blob/blob.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,9 @@ func appendDefaultMountOptions(mountOptions []string, tmpPath, containerName str
648648
"--tmp-path": tmpPath,
649649
"--container-name": containerName,
650650
// prevent billing charges on mounting
651-
"--cancel-list-on-mount-seconds": "60",
651+
"--cancel-list-on-mount-seconds": "10",
652+
// allow remounting using a non-empty tmp-path
653+
"--empty-dir-check": "false",
652654
}
653655

654656
// stores the mount options already included in mountOptions

pkg/blob/blob_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,9 +787,10 @@ func TestAppendDefaultMountOptions(t *testing.T) {
787787
options: []string{"targetPath"},
788788
tmpPath: "/tmp",
789789
containerName: "containerName",
790-
expected: []string{"--cancel-list-on-mount-seconds=60",
790+
expected: []string{"--cancel-list-on-mount-seconds=10",
791791
"--container-name=containerName",
792792
"--pre-mount-validate=true",
793+
"--empty-dir-check=false",
793794
"--tmp-path=/tmp",
794795
"--use-https=true",
795796
"targetPath",
@@ -802,6 +803,7 @@ func TestAppendDefaultMountOptions(t *testing.T) {
802803
expected: []string{"--cancel-list-on-mount-seconds=0",
803804
"--container-name=containerName",
804805
"--pre-mount-validate=false",
806+
"--empty-dir-check=false",
805807
"--tmp-path=/tmp",
806808
"--use-https=true",
807809
"targetPath",

pkg/blob/nodeserver.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,7 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe
277277
if isHnsEnabled {
278278
mountOptions = util.JoinMountOptions(mountOptions, []string{"--use-adls=true"})
279279
}
280-
// set different tmp-path with time info
281-
tmpPath := fmt.Sprintf("%s/%s#%d", "/mnt", volumeID, time.Now().Unix())
280+
tmpPath := fmt.Sprintf("%s/%s", "/mnt", volumeID)
282281
mountOptions = appendDefaultMountOptions(mountOptions, tmpPath, containerName)
283282

284283
args := targetPath

0 commit comments

Comments
 (0)