kubernetes-csi / csi-driver-smb

This driver allows Kubernetes to access SMB Server on both Linux and Windows nodes.
Apache License 2.0
495 stars 136 forks source link

fix: mount with 0777 in volume creation and deletion #843

Closed andyzhangx closed 2 months ago

andyzhangx commented 2 months ago

What type of PR is this? /kind bug

What this PR does / why we need it: fix: mount with 0777 in volume creation and deletion fix: https://github.com/kubernetes-csi/csi-driver-smb/pull/840#discussion_r1745816387

Which issue(s) this PR fixes:

Fixes #

Requirements:

Special notes for your reviewer:

Release note:

none
k8s-ci-robot commented 2 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andyzhangx

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/kubernetes-csi/csi-driver-smb/blob/master/OWNERS)~~ [andyzhangx] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
coveralls commented 2 months ago

Pull Request Test Coverage Report for Build 10758293626

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/smb/controllerserver.go 15 16 93.75%
pkg/smb/smb.go 15 17 88.24%
<!-- Total: 30 33 90.91% -->
Files with Coverage Reduction New Missed Lines %
pkg/smb/controllerserver.go 6 75.2%
<!-- Total: 6 -->
Totals Coverage Status
Change from base Build 10734014917: 0.6%
Covered Lines: 980
Relevant Lines: 1242

💛 - Coveralls
andyzhangx commented 2 months ago

/retest

mpatlasov commented 2 months ago

@andyzhangx , this PR re-introduced the issue https://github.com/kubernetes-csi/csi-driver-smb/issues/834 back. Any directory without write permissions cannot be removed even with 0777 in file_mode/dir_mode. This behavior is easy to observe w/o k8s:

# mount -t cifs -o dir_mode=0777,file_mode=0777,username=jane,password=zz,vers=3.1.1,addr=127.0.0.1,uid=0,gid=0 //127.0.0.1/share /mnt
# mkdir /mnt/dir
# chmod a-w /mnt/dir
# rmdir /mnt/dir
rmdir: failed to remove '/mnt/dir': Permission denied

Should we return that recursive chmod back?

andyzhangx commented 2 months ago

rmdir /mnt/dir

@mpatlasov this PR should fix the issue: https://github.com/kubernetes-csi/csi-driver-smb/pull/851

mpatlasov commented 2 months ago

rmdir /mnt/dir

@mpatlasov this PR should fix the issue: #851

Works for me, thanks!