libmount: when moving a mount point, all sub mount entries in utab sh…#1660
Merged
karelzak merged 1 commit intoutil-linux:masterfrom May 4, 2022
Merged
Conversation
…ould also be updated Given that /run/mount/utab stores paths, this file needs to be adjusted when a mount tree is moved. However the moved tree may contains sub mount points in which case their utab entries (if any) need to also be translated. This patch takes care of that. As suggested in systemd/systemd#15266, a better approach might be to store mount IDs instead of paths since mount IDs remain unchanged when mount trees are moved. Fixes: util-linux#1659
This was referenced Apr 22, 2022
karelzak
added a commit
that referenced
this pull request
May 4, 2022
* avoid double '//' * don't update /fooxxx when /foo update requested (make sure that startswith() returns path terminated by '/') * canonicalize only once the new path -- all in utab/mtab is already canonicalized, so after MS_MOVE we need to care about the new path only * use asprintf() rather than strcpy() and strcat(), don't compose a new path from prefix and subdir when replace entire path Addresses: #1660 Signed-off-by: Karel Zak <kzak@redhat.com>
Collaborator
|
I found some issues in the commit, which should be fixed by 1ec32f4 Probably the most important is that we don't want to update /fooxxx on --move /foo /bar. I have also removed path canonicalization for each entry. It seems enough to canonicalize the path to the wanted target only (as subdirectories in the utab paths should be already canonicalized). |
karelzak
added a commit
that referenced
this pull request
Jul 20, 2022
* avoid double '//' * don't update /fooxxx when /foo update requested (make sure that startswith() returns path terminated by '/') * canonicalize only once the new path -- all in utab/mtab is already canonicalized, so after MS_MOVE we need to care about the new path only * use asprintf() rather than strcpy() and strcat(), don't compose a new path from prefix and subdir when replace entire path Addresses: #1660 Signed-off-by: Karel Zak <kzak@redhat.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…ould also be updated
Given that /run/mount/utab stores paths, this file needs to be adjusted when a
mount tree is moved.
However the moved tree may contains sub mount points in which case their utab
entries (if any) need to also be translated.
This patch takes care of that.
As suggested in systemd/systemd#15266, a better
approach might be to store mount IDs instead of paths since mount IDs remain
unchanged when mount trees are moved.
Fixes: #1659