[CRIU] [PATCH 09/11] notify: open files form a correct mount points (v2)
Andrey Vagin
avagin at openvz.org
Sun Aug 3 11:31:23 PDT 2014
v2: add a comment before mntns_get_root_by_mnt_id(-1);
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
fsnotify.c | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/fsnotify.c b/fsnotify.c
index 903e5ba..77e3332 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,24 @@ 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;
+
+ /* 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);
- 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;
--
1.8.5.3
More information about the CRIU
mailing list