-
Notifications
You must be signed in to change notification settings - Fork 583
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
cmd/snap-update-ns: keep order of existing mount entries #14494
cmd/snap-update-ns: keep order of existing mount entries #14494
Conversation
15335e7
to
aaceabb
Compare
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.
as I said looking at how NeededChanges works at the moment it appears this will mostly affect the order of unmounting of things we kept that we cannot keep anymore the next time around, it looks the right direction but it's hard to predict the general effects, as the logic in NeededChanges is helpful to an extent but as we know has limitations and is hard to predict atm
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.
Thanks
We recently realized that the order of saved mount profile, after performing mount namespace update, was subtly incorrect. The order was seemingly swapped after each operation. In reality, the order reflected the order of performed changes, including the special change type of "keep", which means that an entry is kept intact. Fix the problem by storing "kept" changes in the original order, which is back-to-front compared to the order of changes computed by the algorithm. At the same time, keep track of mount changes in the order of their execution. This probably fixes a hell lot of edge cases and weird behaviors that went undiagnosed for many years. Interestingly a test case had a TODO that hinted at the problem, but it was not clear what the problem was at the time. The TODO is now gone and the test case is now up-to-date. Test data for cmd/snap-update-ns/testdata was re-generated. Jira: https://warthogs.atlassian.net/browse/SNAPDENG-31644 Signed-off-by: Zygmunt Krynicki <[email protected]>
The new function takes the previously existing algorithm out of executeMountProfileUpdate, as the original location makes it very tricky to test due to the presence of all the system interactions through change.Perform. Add some simple tests that show how keep, mount and unmount changes are preserved. Signed-off-by: Zygmunt Krynicki <[email protected]>
9e187a7
to
4404ec1
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #14494 +/- ##
=======================================
Coverage 78.85% 78.85%
=======================================
Files 1079 1079
Lines 145615 145636 +21
=======================================
+ Hits 114828 114847 +19
- Misses 23601 23602 +1
- Partials 7186 7187 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
This is stacked on top of #14491
We recently realized that the order of saved mount profile, after
performing mount namespace update, was subtly incorrect. The order was
seemingly swapped after each operation. In reality, the order reflected
the order of performed changes, including the special change type of
"keep", which means that an entry is kept intact.
Fix the problem by storing "kept" changes in the original order, which
is back-to-front compared to the order of changes computed by the
algorithm. At the same time, keep track of mount changes in the order of
their execution.
This probably fixes a hell lot of edge cases and weird behaviors that
went undiagnosed for many years. Interestingly a test case had a TODO
that hinted at the problem, but it was not clear what the problem was at
the time. The TODO is now gone and the test case is now up-to-date.
Test data for cmd/snap-update-ns/testdata was re-generated.
Jira: https://warthogs.atlassian.net/browse/SNAPDENG-31644
Signed-off-by: Zygmunt Krynicki [email protected]