[ofa-general] Re: [RFC] [PATCH v3] IB/ipoib: Add bonding support to IPoIB

Michael S. Tsirkin mst at dev.mellanox.co.il
Mon Mar 12 08:47:34 PDT 2007


Another question.

> @@ -769,32 +768,32 @@ static void ipoib_set_mcast_list(struct 
>  static void ipoib_neigh_destructor(struct neighbour *n)
>  {
>  	struct ipoib_neigh *neigh;
> -	struct ipoib_dev_priv *priv = netdev_priv(n->dev);
> +	struct ipoib_dev_priv *priv;
>  	unsigned long flags;
>  	struct ipoib_ah *ah = NULL;
>  
> -	ipoib_dbg(priv,
> -		  "neigh_destructor for %06x " IPOIB_GID_FMT "\n",
> -		  IPOIB_QPN(n->ha),
> -		  IPOIB_GID_RAW_ARG(n->ha + 4));
> -
> -	spin_lock_irqsave(&priv->lock, flags);
>  
>  	neigh = *to_ipoib_neigh(n);
>  	if (neigh) {
> +		priv = netdev_priv(neigh->dev);
> +		ipoib_dbg(priv,
> +			  "neigh_destructor for %06x " IPOIB_GID_FMT "\n",
> +			  IPOIB_QPN(n->ha),
> +			  IPOIB_GID_RAW_ARG(n->ha + 4));
> +
> +		spin_lock_irqsave(&priv->lock, flags);
>  		if (neigh->ah)
>  			ah = neigh->ah;
>  		list_del(&neigh->list);
>  		ipoib_neigh_free(n->dev, neigh);
> +		spin_unlock_irqrestore(&priv->lock, flags);
>  	}
> -
> -	spin_unlock_irqrestore(&priv->lock, flags);
> -
>  	if (ah)
>  		ipoib_put_ah(ah);
>  }

Using to_ipoib_neigh outside priv->lock looks problematic.
Can you convince me this does not introduce new races?


-- 
MST



More information about the general mailing list