-
Notifications
You must be signed in to change notification settings - Fork 931
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
Modifying disk quotas causes unnecessary file attribute updates #13115
Comments
If you agree to my conclusions: I already spotted an easy fix for this issue. The |
Is there missing anything in my issue report? I would appreciate any kind of feedback. I recently discovered, that altering every file also causes errors, when the container executes a process where files are deleted while the instance update in LXD is still executing:
|
Thanks for your report. We will endeavour to investigate this soon. I'm not sure why the files are all modified, although I suspect its to do with ensuring all files take part in the quota. |
I just made a PR for this. We encounter the "no such file or directory" error now regularly and have no other option than to retry, which is a bummer for an operation which can take more than 5 minutes. I think a bugfix should be made for LXD 5.21 |
A quick fix would be to have LXD detect this sort of error and continue rather than failing. As for not updating project on all files, this will need more consideration I think. |
I guess that how "quick" that fix would depend on who does the coding. I am not a Go developer at all and re-arranging code to fix a logical error is something I can contribute quickly. Getting into how error handling in Go works, is something very different. |
See if #13815 helps once it lands in latest/edge. To be clear im not rejecting your PR, but in isolation I don't believe it will prevent the "no such file or directory" errors you're getting because the error appears to be happening in Admittedly the likely hood of it happening is reduced by your PR as LXD won't do two walks of the container's filesystem, first to remove the project and then to re-add the new one. I think your PR could provide a speed up indeed, but I will need to consider it more carefully because I'd like to understand why it was done that way originally before changing it. |
I'm not entirely happy, but thanks for providing an alternative solution to the issue. My primary use case is all containers with all limited root disks. If I understand the handling of quota project IDs in LXD correctly, they should never actually change except there is a new volume ID for the root disk (don't know if that ever happens). Only then the "file walk" should be required. My PR would fix performance and also "not found" errors for my use case, because the "file walk" would never happen in my use case (maybe once on container creation?). But maybe there are other use cases. Any chance to get your fix in the currently supported LTS versions? Still preparing the LXD 5.21 update. |
Understood, once my PR lands, if you can rebase your PR so its mergeable and then I'll review in more detail.
Yeah ill backport this and it'll be in LXD 5.21.3. |
Fixes #13115 This avoids setting project quotas when the project does not change ([from Incus](lxc/incus#1163)), and also avoids unnecessary project setting on `DeleteProject`. Reported-by: Marius Klocke [[email protected]](mailto:[email protected]) Closes #13813
@tomponline I see that there have been backports to |
I've included it in #14185 |
Required information
dir
Backend on XFS with project quotas enabledsnap list --all lxd core20 core22 core24 snapd
:Issue description
Updating the
root
disk size in LXD takes longer for containers with many files, because every file in theroot
disk is touched. I observed cases where the instance update took more than 5 minutes. LXD updates thefsx_projid
andfsx_xflags
attributes of all "regular" files. These updates are no-op from my point of view and should be skipped. I cannot image a scenario where there would be a change for those attributes during the lifecycle of a container. Touching every file slows down instance updates although there are no actual changes to the file attributes. I think the code responsible is in here. I think it should be the same issue on EXT4 (not tested).Steps to reproduce
dir
driver on a XFS volume with project quotas enabledroot
disk size of 10GiBxfs_quota -x -c 'stat' /mnt/containers/c-1/rootfs/etc/hosts
ctime
usingstat /mnt/containers/u1/rootfs/etc/hosts
root
disk size to 15GiB:lxc config device set c-1 root size="15GiB"
ctime
:ctime
has been updated, but no file attributes have changedThe text was updated successfully, but these errors were encountered: