[Devel] [PATCH RHEL7 COMMIT] ve: Use ve_name() in devperms ioctl
Konstantin Khorenko
khorenko at virtuozzo.com
Mon Jun 29 06:42:56 PDT 2015
The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.22
------>
commit 812ac8c85ec65cb323c68c07050a20c7b60d806b
Author: Kirill Tkhai <ktkhai at odin.com>
Date: Mon Jun 29 17:42:56 2015 +0400
ve: Use ve_name() in devperms ioctl
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");
}
https://jira.sw.ru/browse/PSBM-34497
Signed-off-by: Kirill Tkhai <ktkhai at odin.com>
Reviewed-by: Vladimir Davydov <vdavydov at parallels.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);
More information about the Devel
mailing list