Commit 6903cc96 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

notify: open files form a correct mount points (v2)

v2: add a comment before mntns_get_root_by_mnt_id(-1);
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 339f456a
...@@ -39,6 +39,8 @@ ...@@ -39,6 +39,8 @@
#include "lock.h" #include "lock.h"
#include "irmap.h" #include "irmap.h"
#include "cr_options.h" #include "cr_options.h"
#include "namespaces.h"
#include "pstree.h"
#include "protobuf.h" #include "protobuf.h"
#include "protobuf/fsnotify.pb-c.h" #include "protobuf/fsnotify.pb-c.h"
...@@ -337,17 +339,24 @@ static char *get_mark_path(const char *who, struct file_remap *remap, ...@@ -337,17 +339,24 @@ static char *get_mark_path(const char *who, struct file_remap *remap,
char *path = NULL; char *path = NULL;
if (remap) { 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", pr_debug("\t\tRestore %s watch for 0x%08x:0x%016lx (via %s)\n",
who, s_dev, i_ino, remap->path); 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;
/* irmap cache is collected in the root namespaces. */
mntns_root = mntns_get_root_by_mnt_id(-1);
if (f_handle->path) {
pr_debug("\t\tRestore with path hint %s\n", 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) if (*target < 0)
goto err; goto err;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment