diff options
| -rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c index 9862c76a83f7..eee66d13e5b9 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c | |||
| @@ -353,27 +353,18 @@ void ipoib_mcast_carrier_on_task(struct work_struct *work) | |||
| 353 | carrier_on_task); | 353 | carrier_on_task); |
| 354 | struct ib_port_attr attr; | 354 | struct ib_port_attr attr; |
| 355 | 355 | ||
| 356 | /* | ||
| 357 | * Take rtnl_lock to avoid racing with ipoib_stop() and | ||
| 358 | * turning the carrier back on while a device is being | ||
| 359 | * removed. | ||
| 360 | */ | ||
| 356 | if (ib_query_port(priv->ca, priv->port, &attr) || | 361 | if (ib_query_port(priv->ca, priv->port, &attr) || |
| 357 | attr.state != IB_PORT_ACTIVE) { | 362 | attr.state != IB_PORT_ACTIVE) { |
| 358 | ipoib_dbg(priv, "Keeping carrier off until IB port is active\n"); | 363 | ipoib_dbg(priv, "Keeping carrier off until IB port is active\n"); |
| 359 | return; | 364 | return; |
| 360 | } | 365 | } |
| 361 | 366 | ||
| 362 | /* | 367 | rtnl_lock(); |
| 363 | * Take rtnl_lock to avoid racing with ipoib_stop() and | ||
| 364 | * turning the carrier back on while a device is being | ||
| 365 | * removed. However, ipoib_stop() will attempt to flush | ||
| 366 | * the workqueue while holding the rtnl lock, so loop | ||
| 367 | * on trylock until either we get the lock or we see | ||
| 368 | * FLAG_ADMIN_UP go away as that signals that we are bailing | ||
| 369 | * and can safely ignore the carrier on work | ||
| 370 | */ | ||
| 371 | while (!rtnl_trylock()) { | ||
| 372 | if (!test_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags)) | ||
| 373 | return; | ||
| 374 | else | ||
| 375 | msleep(20); | ||
| 376 | } | ||
| 377 | if (!ipoib_cm_admin_enabled(priv->dev)) | 368 | if (!ipoib_cm_admin_enabled(priv->dev)) |
| 378 | dev_set_mtu(priv->dev, min(priv->mcast_mtu, priv->admin_mtu)); | 369 | dev_set_mtu(priv->dev, min(priv->mcast_mtu, priv->admin_mtu)); |
| 379 | netif_carrier_on(priv->dev); | 370 | netif_carrier_on(priv->dev); |
