[Devel] [PATCH rh7] ve: Add a handle to C/R aio ctx

Cyrill Gorcunov gorcunov at virtuozzo.com
Mon Feb 15 07:55:06 PST 2016


On Mon, Feb 15, 2016 at 06:05:40PM +0300, Kirill Tkhai wrote:
> This adds ioctl, which allows to set ring buffer tail
> and to wait till aio requests are finished.
> 
> Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
...
> +int ve_aio_ioctl(struct task_struct *task, unsigned int cmd, unsigned long arg)
> +{
> +	struct ve_ioc_arg karg;
> +	struct kioctx *ioctx;
> +	int ret;
> +
> +	if (task != current)
> +		return -EINVAL;
> +
> +	if (copy_from_user(&karg, (void *)arg, sizeof(karg)))
> +		return -EFAULT;
> +
> +	ioctx = lookup_ioctx(karg.ctx_id);
> +	if (!ioctx)
> +		return -EINVAL;;
> +

Kirill, here is a moment I dont understand -- anyone can set aio tail?
Should not we test for ve-is-super (pseudosuper) here?

> +	switch (cmd) {
> +		case VE_AIO_IOC_SET_TAIL:
> +			ret = ve_aio_set_tail(ioctx, karg.val);
> +			break;
> +		case VE_AIO_IOC_WAIT_ACTIVE:
> +			ret = ve_aio_wait_inflight_reqs(ioctx);
> +			break;
> +		default:
> +			ret = -EINVAL;
> +	}

The rest looks good for me.


More information about the Devel mailing list