-
Notifications
You must be signed in to change notification settings - Fork 601
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/snap-update-ns: prevent keeping unneeded mountpoints
In some cases we were keeping mounts from removed layouts, because we were not identifying properly the mounts that we wanted to keep, as we used mountpoint as key for the reuse map used in neededChanges, while there are corner cases when we mount more that once on a given mountpoint. This can happen when, say, we have a layout for /dir/sd1 and another one for /dir/sd2/sd3, being the case that /dir/sd1 and /dir/sd2/sd3 do not exist (but their parent dirs do exist) - /dir/sd2 will be one of the bind mounted directories of the tmpfs that is created in /dir to have a layout on /dir/sd1, while at the same time a tmpfs will be mounted in /dir/sd2 so we can have a layout in /dir/sd2/sd3. So /dir/sd2 is used twice with different filesystem types (none and tmpfs). To prevent this, use as key in the reuse map dir+fstype. As we make sure that mimics are created only once per directory, we should only have one entry per dir+fstype, being fstype either none or tmpfs. In the future we should clean-up mountpoints before performing changes, but that is a bigger change and anyway this fix is needed for mount namespaces already created by older snapd versions.
- Loading branch information
1 parent
8bb01e3
commit b467bdd
Showing
2 changed files
with
56 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters