mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 22:05:36 +00:00
mount: add helper mntns_get_root_by_mnt_id
Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
e4e22a00f7
commit
967dba606a
@@ -676,7 +676,6 @@ int open_path(struct file_desc *d,
|
||||
int(*open_cb)(int mntns_root, struct reg_file_info *, void *), void *arg)
|
||||
{
|
||||
struct reg_file_info *rfi;
|
||||
struct ns_id *ns;
|
||||
int tmp, mntns_root;
|
||||
char *orig_path = NULL;
|
||||
|
||||
@@ -722,12 +721,7 @@ int open_path(struct file_desc *d,
|
||||
}
|
||||
}
|
||||
|
||||
ns = lookup_nsid_by_mnt_id(rfi->rfe->mnt_id);
|
||||
if (ns == NULL)
|
||||
return -1;
|
||||
|
||||
mntns_root = mntns_get_root_fd(ns);
|
||||
|
||||
mntns_root = mntns_get_root_by_mnt_id(rfi->rfe->mnt_id);
|
||||
tmp = open_cb(mntns_root, rfi, arg);
|
||||
if (tmp < 0) {
|
||||
pr_perror("Can't open file %s", rfi->path);
|
||||
|
@@ -6,6 +6,7 @@ extern struct mount_info *mntinfo;
|
||||
struct ns_id;
|
||||
extern int __mntns_get_root_fd(pid_t pid);
|
||||
extern int mntns_get_root_fd(struct ns_id *ns);
|
||||
extern int mntns_get_root_by_mnt_id(int mnt_id);
|
||||
extern struct ns_id *lookup_nsid_by_mnt_id(int mnt_id);
|
||||
|
||||
struct proc_mountinfo;
|
||||
|
10
mount.c
10
mount.c
@@ -2062,6 +2062,16 @@ struct ns_id *lookup_nsid_by_mnt_id(int mnt_id)
|
||||
return mi->nsid;
|
||||
}
|
||||
|
||||
int mntns_get_root_by_mnt_id(int mnt_id)
|
||||
{
|
||||
struct ns_id *mntns;
|
||||
|
||||
mntns = lookup_nsid_by_mnt_id(mnt_id);
|
||||
BUG_ON(mntns == NULL);
|
||||
|
||||
return mntns_get_root_fd(mntns);
|
||||
}
|
||||
|
||||
static int walk_mnt_ns(int (*cb)(struct ns_id *, struct mount_info *, void *), void *arg)
|
||||
{
|
||||
struct mount_info *pms;
|
||||
|
Reference in New Issue
Block a user