-
Couldn't load subscription status.
- Fork 8
fix: umount: delete the right metapath #39
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
Conversation
We were deleting /run/atomfs/meta/ID/destpath/meta/ID/destpath. So doing atomfs mount oci:a dest atomfs umount dest atomfs mount oci:a dest would fail as /run/atomfs/meta/ID/destpath still existed. Signed-off-by: Serge Hallyn <serge@hallyn.com>
143ecf8 to
62af879
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.
I don't really understand this issue. Maybe common.ReplacePathSeparators() has an issue with the path you're sending? I'll try to repro with a test.
In any case I don't think this is the right fix. The /run/atomfs/meta/$nsid is shared by everything you atomfs mount within the same mountNS. This change is doing os.RemoveAll('/run/atomfs/') , which will remove stuff from other mounts too.
| } | ||
| } | ||
|
|
||
| mountNSName, err := common.GetMountNSName() |
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.
I don't see how GetMountNSName() could be returning a string with duplicate path info like you mention in the summary.
GetMountNSName() just looks at the /proc/self/ns/mnt link and strips the result, it should only return a namespace ID number (as a string), like 4026531841.
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.
FWIW I just ran with a patch which prints out the values of mountNSName, common.ReplacePathSeparators(dest)), and common.RuntimeDir(metadir).
Please do that and let us know what you get. It's possible somethign in my context was weird, but what I did was: incus shell vm1; su - ubuntu; lxc-usernsexec -s -- bash; and inside that shell I did atomfs mount.
|
Hm, at the time I was 99% sure I was correct, and it did work on my |
|
Ah, finally, I get it. This patch is not quite right. There is a bug though. But your test in #41 manages to skirt around it! The bug is in RuntimeDir((metadir string). When the ATOMFS_TEST_RUN_DIR variable is set, then it does the right thing. It returns just that env variable, e.g. /tmp/meta. The bats tests always set that env variable, so the test passes. But if ATOMFS_TEST_RUN_DIR is not set, and metadir is passed in (which unmount always does), then it returns the passed-in metadir. Unmount passes in the destination-specific metadir, e.g. /tmp/meta/meta/MOUNTNSNUM/destdir. Then, as my patch description pointed out, UmountWithMetadir appends meta/MOUNTNSNUM/destdir to that variable again, giving us /tmp/meta/meta/MOUNTNSNUM/destdir/meta/MOUNTNSNUM/destdir. |
|
(if it helps, here is some debug output from manual run:) |
|
thanks for the extra detail - I will take a look soon, just wanted to ack that I saw this |
|
Replaced by PR #44 |
We were deleting /run/atomfs/meta/ID/destpath/meta/ID/destpath. So doing
atomfs mount oci:a dest
atomfs umount dest
atomfs mount oci:a dest
would fail as /run/atomfs/meta/ID/destpath still existed.