mount: use ns_mountpoint in collect_mntinfo

At this point ns_mountpoint is equal to mountpoint.

More over let's use robust is_same_path helper in should_skip_mount so
that we don't need to rely on ->mountpoint + 1 hacks.

Cherry-picked from Virtuozzo criu:
https://src.openvz.org/projects/OVZ/repos/criu/commits/d4c4271a0

Changes: use is_same_path helper.

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
This commit is contained in:
Pavel Tikhomirov 2020-05-29 14:34:03 +03:00 committed by Andrei Vagin
parent f2bf6597ca
commit 7b968ceeab

View file

@ -1486,12 +1486,12 @@ bool add_skip_mount(const char *mountpoint)
return true;
}
static bool should_skip_mount(const char *mountpoint)
static bool should_skip_mount(char *mountpoint)
{
struct str_node *pos;
list_for_each_entry(pos, &skip_mount_list, node) {
if (strcmp(mountpoint, pos->string) == 0)
if (is_same_path(mountpoint, pos->string))
return true;
}
@ -1620,8 +1620,8 @@ struct mount_info *parse_mountinfo(pid_t pid, struct ns_id *nsid, bool for_dump)
* fail loudly at "dump" stage if an opened file or another mnt
* depends on this one.
*/
if (for_dump && should_skip_mount(new->mountpoint + 1)) {
pr_info("\tskip %s @ %s\n", fsname, new->mountpoint);
if (for_dump && should_skip_mount(new->ns_mountpoint)) {
pr_info("\tskip %s @ %s\n", fsname, new->ns_mountpoint);
mnt_entry_free(new);
new = NULL;
goto end;