[Devel] [PATCH VZ9 2/3] block/blk-cbt: allow multiple cbts in a single queue

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Thu Jan 23 12:18:11 MSK 2025


> +static int cbt_ioc_stop(struct block_device *bdev, struct blk_user_cbt_info __user *ucbt_ioc)
> +{
> +	struct blk_user_cbt_info ci;
>   	struct request_queue *q;
> +	struct cbt_info *cbt;
> +
> +	if (copy_from_user(&ci, ucbt_ioc, sizeof(ci)))
> +		return -EFAULT;
>   
>   	mutex_lock(&cbt_mutex);
>   	q = bdev_get_queue(bdev);
> -	if(!q->cbt) {
> -		mutex_unlock(&cbt_mutex);
> -		return -EINVAL;
> -	}
> -	blk_cbt_release(q);
> +
> +	cbt = blk_cbt_find(q, ci.ci_name);
> +	if (!cbt)
> +		return -ENOMEM;

EINVAL (as it was before) or ENOENT (no cbt) would suite this error path 
better.

> +
> +	blk_cbt_del(cbt);
> +
>   	mutex_unlock(&cbt_mutex);
>   	return 0;
>   }


More information about the Devel mailing list