btrfs: Do not disable quota on cleanup - #42273
Conversation
|
It seems like the issue here may be that docker does not put itself into a subvolume. I'm wondering if a better fix would be to give /var/lib/docker/btrfs its own subvolume. |
|
That said, I doubt we actually need to disable quota regardless. |
kolyshkin
left a comment
There was a problem hiding this comment.
LGTM (disabling quota on unmount does not make sense).
There was a problem hiding this comment.
(Somewhat orthogonally,) If the given path isn't a subvolume, do you think we should have this function error out so we don't accidentally set a quota on / thinking we're setting it on something more specific?
There was a problem hiding this comment.
I like that idea. And I would also add the /var/lib/docker/btrfs subvolume by default if it's not there.
That's a good idea too (to keep container subvolumes as children of /var/lib/docker/btrfs), but still, it doesn't change the fact that disabling quotas always happens on the whole fs. So I think we need both things fixes: 1) not disabling quotas; 2) ensuring we have /var/lib/docker/btrfs. Thanks for review! |
3699e60 to
2e51d67
Compare
Before this change, cleanup of the btrfs driver (occuring on each daemon shutdown) resulted in disabling quotas. It was done with an assumption that quotas can be enabled or disabled on a subvolume level, which is not true - enabling or disabling quota is always done on a filesystem level. That was leading to disabling quota on btrfs filesystems on each daemon shutdown. This change fixes that behavior and removes misleading `subvol` prefix from functions and methods which set up quota (on a filesystem level). Fixes: moby#34593 Fixes: 401c8d1 ("Add disk quota support for btrfs") Signed-off-by: Michal Rostecki <mrostecki@opensuse.org>
2e51d67 to
1ec689c
Compare
|
@cpuguy83 @tianon After trying out your idea of enforcing First of all, I don't think it's needed. Quotas are applied only on particular moby/daemon/graphdriver/btrfs/btrfs.go Lines 556 to 558 in 62b5194 moby/daemon/graphdriver/btrfs/btrfs.go Lines 668 to 670 in 62b5194 (these are the only places I found which call I don't see any part of the driver which would apply quota on any "higher" directory, thus I don't see any danger of accidentally applying quota on the rootfs subvol even if there is no Secondly, to enforce That migration would look like: The biggest problem, which finally convinced me to not do that, is the There is a Go library which does that, but only on single files: https://github.com/KarpelesLab/reflink If we really wanted to use it, we would have to combine it with Please let me know if you agree with my thoughts or if I'm missing something. For now, I pushed my old version of the PR branch which only removes the "disable quota" part of code, to fix #34593. |
Before this change, cleanup of the btrfs driver (occuring on each daemon
shutdown) resulted in disabling quotas. It was done with an assumption
that quotas can be enabled or disabled on a subvolume level, which is
not true - enabling or disabling quota is always done on a filesystem
level.
That was leading to disabling quota on btrfs filesystems on each daemon
shutdown.
This change fixes that behavior and removes misleading
subvolprefixfrom functions and methods which set up quota (on a filesystem level).
Fixes: #34593
Fixes: docker/for-linux#78
Fixes: 401c8d1 ("Add disk quota support for btrfs" (#19651) )
Signed-off-by: Michal Rostecki mrostecki@opensuse.org
- What I did
Ensured that moby deamon doesn't disable quotas in the btrfs filesystem.
- How I did it
subvolDisableQuotamethod.Cleanupmethod just to unmounting.subbolprefixes from methods which do operations on a filesystem level.- How to verify it
btrfs quota enable /)btrfs qgroup show /runs successfully.I've done those steps inside the dev shell. They require btrfs-progs, which can be installed with
apt update && apt install btrfs-progs.- Description for the changelog
btrfs: Do not disable quota on cleanup
- A picture of a cute animal (not mandatory but encouraged)