-
Notifications
You must be signed in to change notification settings - Fork 18.7k
[20.10 backport] btrfs: Allow unprivileged user to delete subvolumes (kernel >= 4.18) #42253
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
tiborvass
merged 1 commit into
moby:20.10
from
AkihiroSuda:btrfs-allow-unprivileged-20.10
Apr 7, 2021
Merged
[20.10 backport] btrfs: Allow unprivileged user to delete subvolumes (kernel >= 4.18) #42253
tiborvass
merged 1 commit into
moby:20.10
from
AkihiroSuda:btrfs-allow-unprivileged-20.10
Apr 7, 2021
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fix issue 41762 Cherry-pick "drivers: btrfs: Allow unprivileged user to delete subvolumes" from containers/storage containers/storage@831e32b > In btrfs, subvolume can be deleted by IOC_SNAP_DESTROY ioctl but there > is one catch: unprivileged IOC_SNAP_DESTROY call is restricted by default. > > This is because IOC_SNAP_DESTROY only performs permission checks on > the top directory(subvolume) and unprivileged user might delete dirs/files > which cannot be deleted otherwise. This restriction can be relaxed if > user_subvol_rm_allowed mount option is used. > > Although the above ioctl had been the only way to delete a subvolume, > btrfs now allows deletion of subvolume just like regular directory > (i.e. rmdir sycall) since kernel 4.18. > > So if we fail to cleanup subvolume in subvolDelete(), just fallback to > system.EnsureRmoveall() to try to cleanup subvolumes again. > (Note: quota needs privilege, so if quota is enabled we do not fallback) > > This fix will allow non-privileged container works with btrfs backend. Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp> (cherry picked from commit 62b5194) Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
thaJeztah
approved these changes
Apr 6, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@tonistiigi @cpuguy83 ptal |
cpuguy83
approved these changes
Apr 6, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This one also started to become more flaky recently;
|
tiborvass
approved these changes
Apr 7, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Cherry-pick #42203
- What I did
Fix #41762 (
[rootless] driver "btrfs" failed to remove root filesystem: Failed to destroy btrfs snapshot /home/<USER>/.local/share/docker/btrfs/subvolumes for <ID>: operation not permitted
)- How I did it
Cherry-pick "drivers: btrfs: Allow unprivileged user to delete subvolumes" from containers/storage
containers/storage@831e32b
- How to verify it
$ dockerd-rootless.sh --data-root /mnt/btrfs/varlibdocker
$ docker --context=rootless run --rm hello-world
- Description for the changelog
btrfs: Allow unprivileged user to delete subvolumes (kernel >= 4.18)
- A picture of a cute animal (not mandatory but encouraged)
🐧