ACK: [d/azure][PATCH 1/2] UBUNTU: SAUCE: Don't wait in hvnd_query_gid after interface is already bound to ND

Connor Kuehl connor.kuehl at canonical.com
Thu Aug 15 16:59:59 UTC 2019


On 8/14/19 11:08 AM, Marcelo Henrique Cerri wrote:
> From: Long Li <longli at microsoft.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1839673
> 
> The user mode may call hvnd_query_gid multiple times, and from multiple user
> contexts at the same time. If it's already bound, return GID and not wait.
> 
> Signed-off-by: Long Li <longli at microsoft.com>
> Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri at canonical.com>
> ---
>   .../hw/vmbus-rdma/vmbus-rdma-144.0/provider.c          | 10 ++++++----
>   1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c b/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c
> index 8e15522707b9..3ad27e9d6a5d 100644
> --- a/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c
> +++ b/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c
> @@ -604,9 +604,11 @@ static int hvnd_query_gid(struct ib_device *ibdev, u8 port, int index,
>   
>   	debug_check(__func__, __LINE__);
>   
> -	ret = wait_for_completion_timeout(&nd_dev->addr_set, 60*HZ);
> -	if (!ret)
> -		return -ETIMEDOUT;
> +	if (!nd_dev->bind_complete) {
> +		ret = wait_for_completion_timeout(&nd_dev->addr_set, 60*HZ);
> +		if (!ret && !nd_dev->bind_complete)
> +			return -ETIMEDOUT;
> +	}
>   
>   	memset(&(gid->raw[0]), 0, sizeof(gid->raw));
>   	memcpy(&(gid->raw[0]), nd_dev->mac_addr, 6);
> @@ -2752,8 +2754,8 @@ static int hvnd_try_bind_nic(unsigned char *mac, __be32 ip)
>   	/* if we reach here, this means bind_nic is a success */
>   	hvnd_error("successfully bound to IP %pI4 MAC %pM\n",
>   		   nd_dev->ip_addr, nd_dev->mac_addr);
> -	complete(&nd_dev->addr_set);
>   	nd_dev->bind_complete = 1;
> +	complete_all(&nd_dev->addr_set);
>   	mutex_unlock(&nd_dev->bind_mutex);
>   
>   	ret = hvnd_register_device(nd_dev, nd_dev->ip_addr, nd_dev->mac_addr);
> 

For both patches:

Acked-by: Connor Kuehl <connor.kuehl at canonical.com>



More information about the kernel-team mailing list