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

fs: Try unmount without MNT_FORCE before force unmount #978

Merged
merged 1 commit into from
Nov 7, 2022

Conversation

ktock
Copy link
Member

@ktock ktock commented Nov 7, 2022

When we run buildkitd + stargz-snapshotter in rootless mode, we get operation not permitted error on prune.

$ buildctl --addr unix:///home/ktock/.local/run/buildkitd.sock prune --all
DEBU[2022-11-07T01:34:58Z] failed to unmount                             dir=/home/ktock/.local/share/buildkit/runc-stargz/snapshots/snapshotter/snapshots/83/fs error="operation not permitted"
WARN[2022-11-07T01:34:58Z] failed to remove directory                    error="failed to remove directory \"/home/ktock/.local/share/buildkit/runc-stargz/snapshots/snapshotter/snapshots/83\": unlinkat /home/ktock/.local/share/buildkit/runc-stargz/snapshots/snapshotter/snapshots/83/fs: device or resource busy" path=/home/ktock/.local/share/buildkit/runc-stargz/snapshots/snapshotter/snapshots/83

MNT_FORCE flag for umount looks cause this error when it's run by non-root user.
This commit tries to fix this issue by trying umount without MNT_FORCE before the one with MNT_FORCE.


if err := unix.Unmount(mountpoint, 0); err != nil {
if err != unix.EBUSY {
return err
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to retry on EINTR?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the review. Added retrying on EINTR.

Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
@ktock ktock merged commit d0fda4c into containerd:main Nov 7, 2022
@ktock ktock deleted the unmount branch November 7, 2022 05:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants