commit | 8088859bab3cdf62426833ecee85b1aa08ebde32 | [log] [tgz] |
---|---|---|
author | Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp> | Thu Mar 25 18:56:23 2021 +0900 |
committer | Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp> | Tue Apr 06 14:45:01 2021 +0900 |
tree | 43c6e8c0fb45314d3b4ed2f5a143835b687d8b89 | |
parent | 88bd96d6e58e39ee4469fc7442c5001ff68afc48 [diff] |
btrfs: Allow unprivileged user to delete subvolumes (kernel >= 4.18) Fix issue 41762 Cherry-pick "drivers: btrfs: Allow unprivileged user to delete subvolumes" from containers/storage https://github.com/containers/storage/pull/508/commits/831e32b6bdcb530acc4c1cb9059d3c6dba14208c > 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 62b5194f627571c019907edb11bb7bc2edd59933) Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
Moby is an open-source project created by Docker to enable and accelerate software containerization.
It provides a “Lego set” of toolkit components, the framework for assembling them into custom container-based systems, and a place for all container enthusiasts and professionals to experiment and exchange ideas. Components include container build tools, a container registry, orchestration tools, a runtime and more, and these can be used as building blocks in conjunction with other tools and projects.
Moby is an open project guided by strong principles, aiming to be modular, flexible and without too strong an opinion on user experience. It is open to the community to help set its direction.
The Moby Project is intended for engineers, integrators and enthusiasts looking to modify, hack, fix, experiment, invent and build systems based on containers. It is not for people looking for a commercially supported system, but for people who want to work and learn with open source code.
The components and tools in the Moby Project are initially the open source components that Docker and the community have built for the Docker Project. New projects can be added if they fit with the community goals. Docker is committed to using Moby as the upstream for the Docker Product. However, other projects are also encouraged to use Moby as an upstream, and to reuse the components in diverse ways, and all these uses will be treated in the same way. External maintainers and contributors are welcomed.
The Moby project is not intended as a location for support or feature requests for Docker products, but as a place for contributors to work on open source code, fix bugs, and make the code more useful. The releases are supported by the maintainers, community and users, on a best efforts basis only, and are not intended for customers who want enterprise or commercial support; Docker EE is the appropriate product for these use cases.
Brought to you courtesy of our legal counsel. For more context, please see the NOTICE document in this repo.
Use and transfer of Moby may be subject to certain restrictions by the United States and other governments.
It is your responsibility to ensure that your use and/or transfer does not violate applicable laws.
For more information, please see https://www.bis.doc.gov
Moby is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.