Commit 17c04619 authored by Pavel Tikhomirov's avatar Pavel Tikhomirov Committed by Pavel Emelyanov

rst: set mode on ghost-files after write

Do so as in user-namespace on mainstream kernel writing to file
with suid bit set always cleares these bit, regardless to CAP_FSETID.
(see in should_remove_suid plane capable() is used, and same in VZ7)

Also we have an alternative to wait while several patches will get
in MS kernel:

[PATCH v4 0/7] Initial support for user namespace owned mounts
https://lkml.org/lkml/2015/9/23/591
[PATCH v2 12/18] fs: Don't remove suid for CAP_FSETID in s_user_ns
http://www.spinics.net/lists/linux-fsdevel/msg92533.html

Got error while suspending/resuming file_attr test in VZ7CT:
CT-102 criu# cat test/zdtm/live/static/file_attr.out
13:11:01.952: 30635: FAIL: file_attr.c:96: permissions have changed
(errno = 11 (Resource temporarily unavailable))

https://jira.sw.ru/browse/PSBM-41401Signed-off-by: 's avatarPavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent d0ff7307
......@@ -151,6 +151,11 @@ static int create_ghost(struct ghost_file *gf, GhostFileEntry *gfe, struct cr_im
goto err_c;
}
if (fchmod(gfd, gfe->mode)) {
pr_perror("Can't set perms %o on ghost %s", perms, filename);
goto err_c;
}
ret = 0;
err_c:
close(gfd);
......
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