Skip to content

Commit 48be856

Browse files
authored
Merge pull request #583 from andyzhangx/mkdirall
fix: use mkdir -p for creating subdir in mounted base-dir
2 parents d40bdb9 + 17f20a2 commit 48be856

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/smb/controllerserver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
107107
// Create subdirectory under base-dir
108108
// TODO: revisit permissions
109109
internalVolumePath := getInternalVolumePath(d.workingMountDir, smbVol)
110-
if err = os.Mkdir(internalVolumePath, 0777); err != nil && !os.IsExist(err) {
110+
if err = os.MkdirAll(internalVolumePath, 0777); err != nil {
111111
return nil, status.Errorf(codes.Internal, "failed to make subdirectory: %v", err.Error())
112112
}
113113
setKeyValueInMap(parameters, subDirField, smbVol.subDir)

0 commit comments

Comments
 (0)