Skip to content
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

fix umount cleanup #27

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mikemccracken
Copy link
Contributor

@mikemccracken mikemccracken commented Dec 18, 2024

Fix cleanup of underlying molecules, which was broken by recent changes that moved the mount points for the atoms under a directory named after the final mount point - so the refcounting broke.

the fix is to always unmount the atom mount points and then just check if the backing device is still used, and clean it up if not. No "refcounting" in code here, just using the mount table to check if it's in use.

I think this will not work great if there is a mix of mounts in different mount namespaces that use the same atoms.
I am not sure what a good solution for that case would look like.

This was not caught by tests until we ran stacker tests on it, where a test that should have been moved to this repo when we originally split it out caught the cleanup issue. I've moved that test here.

@mikemccracken mikemccracken requested a review from hallyn December 18, 2024 01:00
@mikemccracken mikemccracken force-pushed the 2024.12.16/main/fix-umount-cleanup branch 3 times, most recently from f4da069 to 0e101bd Compare December 18, 2024 21:57
@mikemccracken mikemccracken marked this pull request as ready for review December 18, 2024 22:20
@mikemccracken mikemccracken changed the title WIP- fix umount cleanup fix umount cleanup Dec 18, 2024
Copy link

codecov bot commented Dec 18, 2024

Codecov Report

Attention: Patch coverage is 56.16438% with 32 lines in your changes missing coverage. Please review.

Project coverage is 44.50%. Comparing base (eaa7b43) to head (7673e52).

Files with missing lines Patch % Lines
molecule.go 59.25% 14 Missing and 8 partials ⚠️
squashfs/verity.go 44.44% 10 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main      #27       +/-   ##
===========================================
+ Coverage   15.68%   44.50%   +28.81%     
===========================================
  Files           7       14        +7     
  Lines        1358     1692      +334     
===========================================
+ Hits          213      753      +540     
+ Misses       1117      789      -328     
- Partials       28      150      +122     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mikemccracken mikemccracken force-pushed the 2024.12.16/main/fix-umount-cleanup branch from 1cc33db to be2c195 Compare December 18, 2024 23:53
Since eaa7b43, Umount was not cleaning up backing devices correctly, but
this was not caught in tests. Stacker's test suite had a test that
noticed.

It isn't clear that Umount as used in the `atomfs` cli tool was correct
before eaa7b43 either, because the underlying atom mount points were put
under the overmounted final mount point, and would thus not be shared by
other molecule mounts. This also wasn't being tested though.

This commit fixes Umount, and:
- consolidates all unmounting logic - out of `cmd/umount` and into the
  package in `atomfs.Umount`.
- adds a version of the test from Stacker that noticed this - that test
  belongs here instead of in stacker. Also fixed a couple seeming typos
  in that test that hid failures.
- fixes the lock path used in Umount to match that used in Mount, which
  was out of sync since eaa7b43
- splits out the verity.go squashfs.Umount code to allow for getting
  backing devices of an atom without unmounting it, in order to only
  clean up the backing dev if it is no longer in use

Signed-off-by: Michael McCracken <[email protected]>
- updates codecov action version
- make batstest now builds with coverage and runs all bats tests with
  coverage, then merges into a file codecov knows about

Signed-off-by: Michael McCracken <[email protected]>
@mikemccracken mikemccracken force-pushed the 2024.12.16/main/fix-umount-cleanup branch 2 times, most recently from 1b416ab to 7673e52 Compare December 19, 2024 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant