[ofa-general] [PATCH v2] ipiob: fix rtnl deadlock

Yosef Etigin yosefe at voltaire.com
Sat Aug 16 12:18:50 PDT 2008


> diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
> index 8950e95..ac33c8f 100644
> --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
> +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
> @@ -392,8 +392,16 @@ static int ipoib_mcast_join_complete(int status,
>                                           &priv->mcast_task, 0);
>                mutex_unlock(&mcast_mutex);
>
> -               if (mcast == priv->broadcast)
> +               if (mcast == priv->broadcast) {
> +                       /*
> +                        * Take RTNL lock here to avoid racing with
> +                        * ipoib_stop() and turning the carrier back
> +                        * on while a device is being removed.
> +                        */
> +                       rtnl_lock();
>                        netif_carrier_on(dev);
> +                       rtnl_unlock();
> +               }
>
>                return 0;
>        }

What if you bring the device down, while you get a join completion event?
ipoib_stop() can run in parellel with ipoib_mcast_join_complete(), and you
will just wait for ipoib_stop() to finish to do netif_carrier_on() afterwards.

--Yossi
Unfortunately,
you can't tell if the device was brought down, or still not brought up



More information about the general mailing list