Skip to content

Commit 2473de3

Browse files
authored
Merge pull request #2232 from k8s-infra-cherrypick-robot/cherry-pick-2231-to-release-1.27
[release-1.27] fix: skip chmod setting in readonly mode
2 parents 6df7aa2 + 4a7406c commit 2473de3

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-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)

test/e2e/dynamic_provisioning_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ var _ = ginkgo.Describe("[blob-csi-e2e] Dynamic Provisioning", func() {
269269
VolumeMount: testsuites.VolumeMountDetails{
270270
NameGenerate: "test-volume-",
271271
MountPathGenerate: "/mnt/test-",
272+
ReadOnly: true,
272273
},
273274
AccessModes: []v1.PersistentVolumeAccessMode{v1.ReadOnlyMany},
274275
},

0 commit comments

Comments
 (0)