use mkdir -p for creating subdir in mounted base-dir

This commit is contained in:
alankan-finocomp 2023-02-13 15:30:45 +11:00 committed by GitHub
parent 3a51fd3f0c
commit fb2d112824
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -132,7 +132,7 @@ func (cs *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
// Create subdirectory under base-dir // Create subdirectory under base-dir
internalVolumePath := getInternalVolumePath(cs.Driver.workingMountDir, nfsVol) internalVolumePath := getInternalVolumePath(cs.Driver.workingMountDir, nfsVol)
if err = os.Mkdir(internalVolumePath, 0777); err != nil && !os.IsExist(err) { if err = os.MkdirAll(internalVolumePath, 0777); err != nil {
return nil, status.Errorf(codes.Internal, "failed to make subdirectory: %v", err.Error()) return nil, status.Errorf(codes.Internal, "failed to make subdirectory: %v", err.Error())
} }