[Devel] [PATCH RHEL7 COMMIT] ve/aio: Enumerate ioctl numbers right
Konstantin Khorenko
khorenko at virtuozzo.com
Fri Feb 19 02:05:09 PST 2016
The commit is pushed to "branch-rh7-3.10.0-327.4.5.vz7.11.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.4.5.vz7.11.4
------>
commit b68999c76e3bdff6fff233d4134b4b1cac7586fc
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date: Fri Feb 19 14:05:09 2016 +0400
ve/aio: Enumerate ioctl numbers right
Do not use common used numbers, use custom.
Also, make error codes different.
https://jira.sw.ru/browse/PSBM-42488
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
fs/aio.c | 6 +++---
include/linux/aio.h | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/fs/aio.c b/fs/aio.c
index 22320ce..ce23166 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1860,7 +1860,7 @@ static int ve_aio_set_tail(struct kioctx *ctx, unsigned tail)
mutex_lock(&ctx->ring_lock);
spin_lock_irq(&ctx->completion_lock);
- ret = -EINVAL;
+ ret = -E2BIG;
if (tail >= ctx->nr_events)
goto out;
@@ -1901,14 +1901,14 @@ int ve_aio_ioctl(struct task_struct *task, unsigned int cmd, unsigned long arg)
int ret;
if (task != current)
- return -EINVAL;
+ return -EBADF;
if (copy_from_user(&karg, (void *)arg, sizeof(karg)))
return -EFAULT;
ioctx = lookup_ioctx(karg.ctx_id);
if (!ioctx)
- return -EINVAL;
+ return -ESRCH;
switch (cmd) {
case VE_AIO_IOC_SET_TAIL:
diff --git a/include/linux/aio.h b/include/linux/aio.h
index f40a32b..371fb82 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -16,15 +16,15 @@ struct kiocb;
#define AIO_MAX_NR_DEFAULT 0x10000
-#define VE_AIO_IOC_SET_TAIL 1
-#define VE_AIO_IOC_WAIT_ACTIVE 2
-
struct ve_ioc_arg
{
aio_context_t ctx_id;
unsigned val;
};
+#define VE_AIO_IOC_SET_TAIL _IOW('a', 0, struct ve_ioc_arg)
+#define VE_AIO_IOC_WAIT_ACTIVE _IOW('a', 1, struct ve_ioc_arg)
+
/*
* We use ki_cancel == KIOCB_CANCELLED to indicate that a kiocb has been either
* cancelled or completed (this makes a certain amount of sense because
More information about the Devel
mailing list