Skip to content

Fix: prevent snapshotter from deleting in-use devices during snapshot removal#350

Merged
BigVan merged 1 commit into
containerd:mainfrom
Aaron-ding-coder:z.d/dev
Mar 30, 2026
Merged

Fix: prevent snapshotter from deleting in-use devices during snapshot removal#350
BigVan merged 1 commit into
containerd:mainfrom
Aaron-ding-coder:z.d/dev

Conversation

@Aaron-ding-coder
Copy link
Copy Markdown

@Aaron-ding-coder Aaron-ding-coder commented Mar 30, 2026

What this PR does / why we need it:
When using a Kata runtime, the OverlayFS mount is performed in a different namespace, making it invisible from the host environment. However, when performing unmount and device detachment, the snapshotter checks if the host has any mounts using this device and will continue device detachment if it detects no host-level mounts.

In this case, during UnmountAndDetachBlockDevice, checkOverlaybdInUse will return "not in use," even though this snapshot is actually being used by another active snapshot.

Therefore, when we perform unmount and device detach, we should check the DB to see whether an active snapshot is using this device. If true, we shouldn't unmount or detach the block device, because this will cause active containers to lose access to their filesystems.

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?

@Aaron-ding-coder Aaron-ding-coder changed the title Z.d/dev 修复 snapshotter 在删除 snapshot 的时候,误把整在被其他 snapshot 使用的 device 删掉 Mar 30, 2026
@Aaron-ding-coder Aaron-ding-coder changed the title 修复 snapshotter 在删除 snapshot 的时候,误把整在被其他 snapshot 使用的 device 删掉 Fix: prevent snapshotter from deleting in-use devices during snapshot removal Mar 30, 2026
… removal

Signed-off-by: 洛可 <dingzhaowen.dzw@alibaba-inc.com>
@BigVan BigVan added the ok-to-test Pull request is ok to run ci test label Mar 30, 2026
@BigVan
Copy link
Copy Markdown
Member

BigVan commented Mar 30, 2026

LGTM

@BigVan BigVan merged commit 43c3295 into containerd:main Mar 30, 2026
5 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.

2 participants