Skip to content

Add support for checking if a device is being used by a filesystem #1658

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

pwschuurman
Copy link
Contributor

@pwschuurman pwschuurman commented Apr 4, 2024

What type of PR is this?
/kind bug

What this PR does / why we need it:
Summary: If a PD block device is still being used by the filesystem (misconfiguration, mount namespace capture), return an error during NodeUnstage.

Currently the PDCSI driver performs an unmount on the globalmount during NodeUnstage, and success signals that ControllerUnpublish (GCE disk detach) can proceed. Normally successful mount is an indicator that there is no other consumer of the device on the OS. There are some sitautions where this may not be true:

  1. Mount Namespace Capture: If a mount namespace is held open by a container process, due to an open file descriptor to /proc/<pid>/ns/mnt, a private mount point to the block device may exist in a container's mount namespace. Typically this only occurs if there is some other process that has root access to the OS and causes this to occur.
  2. If there is some other user on the system which creates a private bind mount from the globalmount. The unmount and removal of the globalmount does not private to private bind mounts, resulting in a successful unmount in PDCSI, despite the device still being in use.

Which issue(s) this PR fixes:
Fixes #1657

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Check if volume's block device is still in use during NodeUnstage

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Apr 4, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pwschuurman

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:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 4, 2024
@pwschuurman
Copy link
Contributor Author

/assign @mattcary

@mattcary
Copy link
Contributor

/lgtm

Good idea to test in e2e. Probably we should have done that for disable device...

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 19, 2024
@k8s-ci-robot k8s-ci-robot merged commit e26e399 into kubernetes-sigs:master Apr 19, 2024
7 checks passed
@pwschuurman
Copy link
Contributor Author

/cherry-pick release-1.13

@k8s-infra-cherrypick-robot

@pwschuurman: #1658 failed to apply on top of branch "release-1.13":

Applying: Add support for checking if a device is being used by a filesystem
Using index info to reconstruct a base tree...
M	pkg/gce-pd-csi-driver/node.go
M	test/e2e/tests/single_zone_e2e_test.go
Falling back to patching base and 3-way merge...
Auto-merging test/e2e/tests/single_zone_e2e_test.go
Auto-merging pkg/gce-pd-csi-driver/node.go
CONFLICT (content): Merge conflict in pkg/gce-pd-csi-driver/node.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Add support for checking if a device is being used by a filesystem
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-1.13

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@pwschuurman
Copy link
Contributor Author

@pwschuurman: #1658 failed to apply on top of branch "release-1.13":

Applying: Add support for checking if a device is being used by a filesystem
Using index info to reconstruct a base tree...
M	pkg/gce-pd-csi-driver/node.go
M	test/e2e/tests/single_zone_e2e_test.go
Falling back to patching base and 3-way merge...
Auto-merging test/e2e/tests/single_zone_e2e_test.go
Auto-merging pkg/gce-pd-csi-driver/node.go
CONFLICT (content): Merge conflict in pkg/gce-pd-csi-driver/node.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Add support for checking if a device is being used by a filesystem
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

Cherry pick #1805

k8s-ci-robot added a commit that referenced this pull request Aug 14, 2024
…658-upstream-release-1.13

Automated cherry pick of #1658: Add support for checking if a device is being used by a
@pwschuurman
Copy link
Contributor Author

Cherrypick for release-1.12: #1845

k8s-ci-robot added a commit that referenced this pull request Oct 10, 2024
…658-upstream-release-1.12

Automated cherry pick of #1658: Add support for checking if a device is being used by a filesystem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NodeUnstage: Check if block device filesystem is in use
4 participants