[CRIU] [PATCH 08/11] notify: open files form a correct mount points
Pavel Emelyanov
xemul at parallels.com
Mon Aug 4 03:42:52 PDT 2014
On 07/25/2014 01:12 AM, Andrey Vagin wrote:
> Signed-off-by: Andrey Vagin <avagin at openvz.org>
> ---
> fsnotify.c | 20 ++++++++++++++------
> 1 file changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/fsnotify.c b/fsnotify.c
> index 903e5ba..aa0e42d 100644
> --- a/fsnotify.c
> +++ b/fsnotify.c
> @@ -39,6 +39,8 @@
> #include "lock.h"
> #include "irmap.h"
> #include "cr_options.h"
> +#include "namespaces.h"
> +#include "pstree.h"
>
> #include "protobuf.h"
> #include "protobuf/fsnotify.pb-c.h"
> @@ -337,17 +339,23 @@ static char *get_mark_path(const char *who, struct file_remap *remap,
> char *path = NULL;
>
> if (remap) {
> + int mntns_root;
> +
> + mntns_root = mntns_get_root_by_mnt_id(remap->mnt_id);
> +
> pr_debug("\t\tRestore %s watch for 0x%08x:0x%016lx (via %s)\n",
> who, s_dev, i_ino, remap->path);
> - return remap->path;
> - }
> + *target = openat(mntns_root, remap->path, O_PATH);
> + } else if (f_handle->path) {
> + int mntns_root;
> +
> + mntns_root = mntns_get_root_by_mnt_id(-1);
Why is that correct?
>
> - if (f_handle->path) {
> pr_debug("\t\tRestore with path hint %s\n", f_handle->path);
> - return f_handle->path;
> - }
> + *target = openat(mntns_root, f_handle->path, O_PATH);
> + } else
> + *target = open_handle(s_dev, i_ino, f_handle);
>
> - *target = open_handle(s_dev, i_ino, f_handle);
> if (*target < 0)
> goto err;
>
>
More information about the CRIU
mailing list