Skip to content

Commit 6acf7de

Browse files
authored
Merge pull request #1478 from huww98/fix-subpath-creation
nas: fix subpath creation
2 parents 785ff8b + 9b56d0f commit 6acf7de

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/nas/utils.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,11 @@ func doMount(mounter mountutils.Interface, opt *Options, targetPath, volumeId, p
139139
}
140140
rootSource := fmt.Sprintf("%s:%s", opt.Server, rootPath)
141141
klog.Infof("trying to create subpath %s in %s", opt.Path, opt.Server)
142-
tmpPath, err := os.MkdirTemp(filepath.Join(utils.KubeletRootDir, "csi-plugins", driverName, "node"), "subpath-creation_"+volumeId+"_")
142+
tmpPath := filepath.Join(utils.KubeletRootDir, "csi-plugins", driverName, "node")
143+
if err := os.MkdirAll(tmpPath, 0o700); err != nil {
144+
return err
145+
}
146+
tmpPath, err = os.MkdirTemp(tmpPath, "subpath-creation_"+volumeId+"_")
143147
if err != nil {
144148
return err
145149
}

0 commit comments

Comments
 (0)