Commit 595e2c76 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

files-reg: don't forgot about mntns_root in linked-remap

All operations with files should be relative to mntns_root
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent e149e125
...@@ -300,8 +300,9 @@ static int create_link_remap(char *path, int len, int lfd, u32 *idp) ...@@ -300,8 +300,9 @@ static int create_link_remap(char *path, int len, int lfd, u32 *idp)
* will fail if we chose the bad one. * will fail if we chose the bad one.
*/ */
memcpy(link_name, path, len); link_name[0] = '.';
tmp = link_name + len; memcpy(link_name + 1, path, len);
tmp = link_name + len + 1;
while (*tmp != '/') { while (*tmp != '/') {
BUG_ON(tmp == link_name); BUG_ON(tmp == link_name);
tmp--; tmp--;
...@@ -311,12 +312,12 @@ static int create_link_remap(char *path, int len, int lfd, u32 *idp) ...@@ -311,12 +312,12 @@ static int create_link_remap(char *path, int len, int lfd, u32 *idp)
rfe.flags = 0; rfe.flags = 0;
rfe.pos = 0; rfe.pos = 0;
rfe.fown = &fwn; rfe.fown = &fwn;
rfe.name = link_name; rfe.name = link_name + 1;
/* Any 'unique' name works here actually. Remap works by reg-file ids. */ /* Any 'unique' name works here actually. Remap works by reg-file ids. */
sprintf(tmp + 1, "link_remap.%d", rfe.id); sprintf(tmp + 1, "link_remap.%d", rfe.id);
if (linkat(lfd, "", 0, link_name, AT_EMPTY_PATH) < 0) { if (linkat(lfd, "", mntns_root, link_name, AT_EMPTY_PATH) < 0) {
pr_perror("Can't link remap to %s", path); pr_perror("Can't link remap to %s", path);
return -1; return -1;
} }
......
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