[Devel] [PATCH rh7] ve: Use ve_name() in devperms ioctl
Kirill Tkhai
ktkhai at odin.com
Fri Jun 26 10:13:04 PDT 2015
https://jira.sw.ru/browse/PSBM-34497
В Пт, 26/06/2015 в 20:02 +0300, Kirill Tkhai пишет:
> In PCS7 we use UUID instead of ctid for cgroup directories names,
> so we should open it.
>
> Below is small test program to check the patch works:
>
> #include <linux/vzcalluser.h>
> #include <stdio.h>
> #include <fcntl.h>
>
> main()
> {
> struct vzctl_setdevperms s;
> int fd = open("/dev/vzctl", O_RDWR);
> unsigned major = 182;
> unsigned minor = 281233;
> s.veid = 101;
> s.type = S_IFBLK|030;
> s.dev = (minor & 0xff) | (major << 8) | ((minor & ~0xff) << 12);
> s.mask = S_IXUSR;
>
> if (fd < 0) {
> printf("open err\n");
> return -1;
> }
>
> if (ioctl(fd, VZCTL_SETDEVPERMS, &s))
> printf("ioctl\n");
> }
>
> Signed-off-by: Kirill Tkhai <ktkhai at odin.com>
> ---
> kernel/ve/vecalls.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/ve/vecalls.c b/kernel/ve/vecalls.c
> index e262c5e..be4fb1e 100644
> --- a/kernel/ve/vecalls.c
> +++ b/kernel/ve/vecalls.c
> @@ -160,13 +160,14 @@ static int real_setdevperms(envid_t veid, unsigned type,
> return -ESRCH;
>
> down_read(&ve->op_sem);
> - err = -ESRCH;
>
> - cgroup = ve_cgroup_open(devices_root, 0, ve->veid);
> - err = PTR_ERR(cgroup);
> - if (IS_ERR(cgroup))
> + cgroup = cgroup_kernel_open(devices_root, 0, ve_name(ve));
> + if (IS_ERR_OR_NULL(cgroup)) {
> + err = PTR_ERR(cgroup) ? : -ESRCH;
> goto out;
> + }
>
> + err = -EAGAIN;
> if (ve->is_running)
> err = devcgroup_set_perms_ve(cgroup, type, dev, mask);
>
>
> _______________________________________________
> Devel mailing list
> Devel at openvz.org
> https://lists.openvz.org/mailman/listinfo/devel
More information about the Devel
mailing list