Skip to content
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

check if snapshot holds mountpoint before remove #302

Merged
merged 1 commit into from
Sep 12, 2024

Conversation

WaberZhuang
Copy link
Contributor

What this PR does / why we need it:
Enhance snapshotter.Remove to avoid delete snapshots which hold a mountpoint.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Please check the following list:

  • Does the affected code have corresponding tests, e.g. unit test, E2E test?
  • Does this change require a documentation update?
  • Does this introduce breaking changes that would require an announcement or bumping the major version?
  • Do all new files have an appropriate license header?

@@ -980,6 +990,19 @@ func (o *snapshotter) Remove(ctx context.Context, key string) (err error) {
return nil
}

func (o *snapshotter) hasMountpoint(ctx context.Context, id string) (bool, error) {
if out, err := exec.CommandContext(ctx, "/bin/bash", "-c",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create a process to check mount point is so tricky.

@BigVan
Copy link
Member

BigVan commented Sep 12, 2024

LGTM

@BigVan BigVan added the ok-to-test Pull request is ok to run ci test label Sep 12, 2024
@liulanzheng liulanzheng merged commit 360dff9 into containerd:main Sep 12, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test Pull request is ok to run ci test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants