Commit d09e2693 authored by Dave Ertman's avatar Dave Ertman Committed by Jeff Kirsher

ice: Avoid nested RTNL locking in ice_dis_vsi

ice_dis_vsi() performs an rtnl_lock() if it detects a netdev that is
running on the VSI. In cases where the RTNL lock has already been
acquired, a deadlock results. Add a boolean to pass to ice_dis_vsi to
tell it if the RTNL lock is already held.
Signed-off-by: default avatarDave Ertman <david.m.ertman@intel.com>
Signed-off-by: default avatarAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 995c90f2
...@@ -3137,8 +3137,9 @@ static void ice_vsi_release_all(struct ice_pf *pf) ...@@ -3137,8 +3137,9 @@ static void ice_vsi_release_all(struct ice_pf *pf)
/** /**
* ice_dis_vsi - pause a VSI * ice_dis_vsi - pause a VSI
* @vsi: the VSI being paused * @vsi: the VSI being paused
* @locked: is the rtnl_lock already held
*/ */
static void ice_dis_vsi(struct ice_vsi *vsi) static void ice_dis_vsi(struct ice_vsi *vsi, bool locked)
{ {
if (test_bit(__ICE_DOWN, vsi->state)) if (test_bit(__ICE_DOWN, vsi->state))
return; return;
...@@ -3147,9 +3148,13 @@ static void ice_dis_vsi(struct ice_vsi *vsi) ...@@ -3147,9 +3148,13 @@ static void ice_dis_vsi(struct ice_vsi *vsi)
if (vsi->type == ICE_VSI_PF && vsi->netdev) { if (vsi->type == ICE_VSI_PF && vsi->netdev) {
if (netif_running(vsi->netdev)) { if (netif_running(vsi->netdev)) {
rtnl_lock(); if (!locked) {
vsi->netdev->netdev_ops->ndo_stop(vsi->netdev); rtnl_lock();
rtnl_unlock(); vsi->netdev->netdev_ops->ndo_stop(vsi->netdev);
rtnl_unlock();
} else {
vsi->netdev->netdev_ops->ndo_stop(vsi->netdev);
}
} else { } else {
ice_vsi_close(vsi); ice_vsi_close(vsi);
} }
...@@ -3188,7 +3193,7 @@ static void ice_pf_dis_all_vsi(struct ice_pf *pf) ...@@ -3188,7 +3193,7 @@ static void ice_pf_dis_all_vsi(struct ice_pf *pf)
ice_for_each_vsi(pf, v) ice_for_each_vsi(pf, v)
if (pf->vsi[v]) if (pf->vsi[v])
ice_dis_vsi(pf->vsi[v]); ice_dis_vsi(pf->vsi[v], false);
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment