Merge branch 'mellanox' into k.o/for-next
Signed-off-by: Doug Ledford <dledford@redhat.com>
Esse commit está contido em:
@@ -337,6 +337,7 @@ struct ipoib_dev_priv {
|
||||
|
||||
struct rw_semaphore vlan_rwsem;
|
||||
struct mutex mcast_mutex;
|
||||
struct mutex sysfs_mutex;
|
||||
|
||||
struct rb_root path_tree;
|
||||
struct list_head path_list;
|
||||
|
@@ -1506,9 +1506,14 @@ static ssize_t set_mode(struct device *d, struct device_attribute *attr,
|
||||
if (test_bit(IPOIB_FLAG_GOING_DOWN, &priv->flags))
|
||||
return -EPERM;
|
||||
|
||||
if (!rtnl_trylock())
|
||||
if (!mutex_trylock(&priv->sysfs_mutex))
|
||||
return restart_syscall();
|
||||
|
||||
if (!rtnl_trylock()) {
|
||||
mutex_unlock(&priv->sysfs_mutex);
|
||||
return restart_syscall();
|
||||
}
|
||||
|
||||
ret = ipoib_set_mode(dev, buf);
|
||||
|
||||
/* The assumption is that the function ipoib_set_mode returned
|
||||
@@ -1517,6 +1522,7 @@ static ssize_t set_mode(struct device *d, struct device_attribute *attr,
|
||||
*/
|
||||
if (ret != -EBUSY)
|
||||
rtnl_unlock();
|
||||
mutex_unlock(&priv->sysfs_mutex);
|
||||
|
||||
return (!ret || ret == -EBUSY) ? count : ret;
|
||||
}
|
||||
|
@@ -1893,6 +1893,7 @@ static void ipoib_build_priv(struct net_device *dev)
|
||||
spin_lock_init(&priv->lock);
|
||||
init_rwsem(&priv->vlan_rwsem);
|
||||
mutex_init(&priv->mcast_mutex);
|
||||
mutex_init(&priv->sysfs_mutex);
|
||||
|
||||
INIT_LIST_HEAD(&priv->path_list);
|
||||
INIT_LIST_HEAD(&priv->child_intfs);
|
||||
@@ -2242,13 +2243,7 @@ static struct net_device *ipoib_add_port(const char *format,
|
||||
|
||||
INIT_IB_EVENT_HANDLER(&priv->event_handler,
|
||||
priv->ca, ipoib_event);
|
||||
result = ib_register_event_handler(&priv->event_handler);
|
||||
if (result < 0) {
|
||||
printk(KERN_WARNING "%s: ib_register_event_handler failed for "
|
||||
"port %d (ret = %d)\n",
|
||||
hca->name, port, result);
|
||||
goto event_failed;
|
||||
}
|
||||
ib_register_event_handler(&priv->event_handler);
|
||||
|
||||
result = register_netdev(priv->dev);
|
||||
if (result) {
|
||||
@@ -2281,8 +2276,6 @@ register_failed:
|
||||
set_bit(IPOIB_STOP_NEIGH_GC, &priv->flags);
|
||||
cancel_delayed_work(&priv->neigh_reap_task);
|
||||
flush_workqueue(priv->wq);
|
||||
|
||||
event_failed:
|
||||
ipoib_dev_cleanup(priv->dev);
|
||||
|
||||
device_init_failed:
|
||||
@@ -2352,7 +2345,11 @@ static void ipoib_remove_one(struct ib_device *device, void *client_data)
|
||||
cancel_delayed_work(&priv->neigh_reap_task);
|
||||
flush_workqueue(priv->wq);
|
||||
|
||||
/* Wrap rtnl_lock/unlock with mutex to protect sysfs calls */
|
||||
mutex_lock(&priv->sysfs_mutex);
|
||||
unregister_netdev(priv->dev);
|
||||
mutex_unlock(&priv->sysfs_mutex);
|
||||
|
||||
rn->free_rdma_netdev(priv->dev);
|
||||
|
||||
list_for_each_entry_safe(cpriv, tcpriv, &priv->child_intfs, list)
|
||||
|
@@ -133,12 +133,20 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey)
|
||||
snprintf(intf_name, sizeof intf_name, "%s.%04x",
|
||||
ppriv->dev->name, pkey);
|
||||
|
||||
if (!rtnl_trylock())
|
||||
if (!mutex_trylock(&ppriv->sysfs_mutex))
|
||||
return restart_syscall();
|
||||
|
||||
if (!rtnl_trylock()) {
|
||||
mutex_unlock(&ppriv->sysfs_mutex);
|
||||
return restart_syscall();
|
||||
}
|
||||
|
||||
priv = ipoib_intf_alloc(ppriv->ca, ppriv->port, intf_name);
|
||||
if (!priv)
|
||||
if (!priv) {
|
||||
rtnl_unlock();
|
||||
mutex_unlock(&ppriv->sysfs_mutex);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
down_write(&ppriv->vlan_rwsem);
|
||||
|
||||
@@ -164,8 +172,8 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey)
|
||||
|
||||
out:
|
||||
up_write(&ppriv->vlan_rwsem);
|
||||
|
||||
rtnl_unlock();
|
||||
mutex_unlock(&ppriv->sysfs_mutex);
|
||||
|
||||
if (result) {
|
||||
free_netdev(priv->dev);
|
||||
@@ -188,9 +196,14 @@ int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey)
|
||||
if (test_bit(IPOIB_FLAG_GOING_DOWN, &ppriv->flags))
|
||||
return -EPERM;
|
||||
|
||||
if (!rtnl_trylock())
|
||||
if (!mutex_trylock(&ppriv->sysfs_mutex))
|
||||
return restart_syscall();
|
||||
|
||||
if (!rtnl_trylock()) {
|
||||
mutex_unlock(&ppriv->sysfs_mutex);
|
||||
return restart_syscall();
|
||||
}
|
||||
|
||||
down_write(&ppriv->vlan_rwsem);
|
||||
list_for_each_entry_safe(priv, tpriv, &ppriv->child_intfs, list) {
|
||||
if (priv->pkey == pkey &&
|
||||
@@ -208,6 +221,7 @@ int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey)
|
||||
}
|
||||
|
||||
rtnl_unlock();
|
||||
mutex_unlock(&ppriv->sysfs_mutex);
|
||||
|
||||
if (dev) {
|
||||
free_netdev(dev);
|
||||
|
@@ -106,9 +106,7 @@ static int iser_create_device_ib_res(struct iser_device *device)
|
||||
|
||||
INIT_IB_EVENT_HANDLER(&device->event_handler, ib_dev,
|
||||
iser_event_handler);
|
||||
if (ib_register_event_handler(&device->event_handler))
|
||||
goto cq_err;
|
||||
|
||||
ib_register_event_handler(&device->event_handler);
|
||||
return 0;
|
||||
|
||||
cq_err:
|
||||
@@ -141,7 +139,7 @@ static void iser_free_device_ib_res(struct iser_device *device)
|
||||
comp->cq = NULL;
|
||||
}
|
||||
|
||||
(void)ib_unregister_event_handler(&device->event_handler);
|
||||
ib_unregister_event_handler(&device->event_handler);
|
||||
ib_dealloc_pd(device->pd);
|
||||
|
||||
kfree(device->comps);
|
||||
|
@@ -954,12 +954,7 @@ static int vema_register(struct opa_vnic_ctrl_port *cport)
|
||||
|
||||
INIT_IB_EVENT_HANDLER(&port->event_handler,
|
||||
cport->ibdev, opa_vnic_event);
|
||||
ret = ib_register_event_handler(&port->event_handler);
|
||||
if (ret) {
|
||||
c_err("port %d: event handler register failed\n", i);
|
||||
vema_unregister(cport);
|
||||
return ret;
|
||||
}
|
||||
ib_register_event_handler(&port->event_handler);
|
||||
|
||||
idr_init(&port->vport_idr);
|
||||
mutex_init(&port->lock);
|
||||
|
@@ -2238,7 +2238,7 @@ static int srpt_write_pending(struct se_cmd *se_cmd)
|
||||
cqe, first_wr);
|
||||
cqe = NULL;
|
||||
}
|
||||
|
||||
|
||||
ret = ib_post_send(ch->qp, first_wr, &bad_wr);
|
||||
if (ret) {
|
||||
pr_err("%s: ib_post_send() returned %d for %d (avail: %d)\n",
|
||||
@@ -2530,8 +2530,7 @@ static void srpt_add_one(struct ib_device *device)
|
||||
|
||||
INIT_IB_EVENT_HANDLER(&sdev->event_handler, sdev->device,
|
||||
srpt_event_handler);
|
||||
if (ib_register_event_handler(&sdev->event_handler))
|
||||
goto err_cm;
|
||||
ib_register_event_handler(&sdev->event_handler);
|
||||
|
||||
sdev->ioctx_ring = (struct srpt_recv_ioctx **)
|
||||
srpt_alloc_ioctx_ring(sdev, sdev->srq_size,
|
||||
|
Referência em uma nova issue
Block a user