[openib-general] [RFC] [PATCH] IB/uverbs: Don't serialize with ib_uverbs_idr_mutex

Michael S. Tsirkin mst at mellanox.co.il
Mon Jun 12 22:11:49 PDT 2006


Quoting r. Roland Dreier <rdreier at cisco.com>:
> @@ -1089,10 +1271,8 @@ ssize_t ib_uverbs_modify_qp(struct ib_uv
>  	if (!attr)
>  		return -ENOMEM;
>  
> -	mutex_lock(&ib_uverbs_idr_mutex);
> -
> -	qp = idr_find(&ib_uverbs_qp_idr, cmd.qp_handle);
> -	if (!qp || qp->uobject->context != file->ucontext) {
> +	qp = idr_read_qp(cmd.qp_handle, file->ucontext);
> +	if (!qp) {
>  		ret = -EINVAL;
>  		goto out;
>  	}
> @@ -1144,13 +1324,15 @@ ssize_t ib_uverbs_modify_qp(struct ib_uv
>  	attr->alt_ah_attr.port_num 	    = cmd.alt_dest.port_num;
>  
>  	ret = ib_modify_qp(qp, attr, cmd.attr_mask);
> +
> +	put_qp_read(qp);
> +
>  	if (ret)
>  		goto out;
>  
>  	ret = in_len;
>  
>  out:
> -	mutex_unlock(&ib_uverbs_idr_mutex);
>  	kfree(attr);
>  
>  	return ret;

Won't this let the user issue multiple modify QP commands in parallel
on the same QP? mthca at least does not protect against such attempts,
and doing this will confuse the hardware.

-- 
MST




More information about the general mailing list