Skip to content

Commit 94684ef

Browse files
andyzhangxk8s-infra-cherrypick-robot
authored andcommitted
fix: skip chmod setting in readonly mode
1 parent 6df7aa2 commit 94684ef

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pkg/blob/nodeserver.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,12 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe
389389
}
390390

391391
if performChmodOp {
392-
if err := chmodIfPermissionMismatch(targetPath, os.FileMode(mountPermissions)); err != nil {
393-
return nil, status.Error(codes.Internal, err.Error())
392+
if !isReadOnlyFromCapability(volumeCapability) {
393+
if err := chmodIfPermissionMismatch(targetPath, os.FileMode(mountPermissions)); err != nil {
394+
return nil, status.Error(codes.Internal, err.Error())
395+
}
396+
} else {
397+
klog.V(2).Infof("skip chmod on targetPath(%s) since it's a read-only mount", targetPath)
394398
}
395399
} else {
396400
klog.V(2).Infof("skip chmod on targetPath(%s) since mountPermissions is set as 0", targetPath)

0 commit comments

Comments
 (0)