diff options
author | Dave Ertman <david.m.ertman@intel.com> | 2018-10-26 13:41:04 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2018-11-13 12:09:26 -0500 |
commit | d09e2693b689cc82cd9bae0c4f19f5122708f83e (patch) | |
tree | b364e7dd7c2ed13919fbf24fbc40e34512c34a86 /drivers/net/ethernet/intel/ice/ice_main.c | |
parent | 995c90f2de819b020bdb0758ea4d486b0851e11a (diff) |
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: Dave Ertman <david.m.ertman@intel.com>
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_main.c')
-rw-r--r-- | drivers/net/ethernet/intel/ice/ice_main.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index ea79e5e1f589..089b0f0b2e71 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c | |||
@@ -3137,8 +3137,9 @@ static void ice_vsi_release_all(struct ice_pf *pf) | |||
3137 | /** | 3137 | /** |
3138 | * ice_dis_vsi - pause a VSI | 3138 | * ice_dis_vsi - pause a VSI |
3139 | * @vsi: the VSI being paused | 3139 | * @vsi: the VSI being paused |
3140 | * @locked: is the rtnl_lock already held | ||
3140 | */ | 3141 | */ |
3141 | static void ice_dis_vsi(struct ice_vsi *vsi) | 3142 | static void ice_dis_vsi(struct ice_vsi *vsi, bool locked) |
3142 | { | 3143 | { |
3143 | if (test_bit(__ICE_DOWN, vsi->state)) | 3144 | if (test_bit(__ICE_DOWN, vsi->state)) |
3144 | return; | 3145 | return; |
@@ -3147,9 +3148,13 @@ static void ice_dis_vsi(struct ice_vsi *vsi) | |||
3147 | 3148 | ||
3148 | if (vsi->type == ICE_VSI_PF && vsi->netdev) { | 3149 | if (vsi->type == ICE_VSI_PF && vsi->netdev) { |
3149 | if (netif_running(vsi->netdev)) { | 3150 | if (netif_running(vsi->netdev)) { |
3150 | rtnl_lock(); | 3151 | if (!locked) { |
3151 | vsi->netdev->netdev_ops->ndo_stop(vsi->netdev); | 3152 | rtnl_lock(); |
3152 | rtnl_unlock(); | 3153 | vsi->netdev->netdev_ops->ndo_stop(vsi->netdev); |
3154 | rtnl_unlock(); | ||
3155 | } else { | ||
3156 | vsi->netdev->netdev_ops->ndo_stop(vsi->netdev); | ||
3157 | } | ||
3153 | } else { | 3158 | } else { |
3154 | ice_vsi_close(vsi); | 3159 | ice_vsi_close(vsi); |
3155 | } | 3160 | } |
@@ -3188,7 +3193,7 @@ static void ice_pf_dis_all_vsi(struct ice_pf *pf) | |||
3188 | 3193 | ||
3189 | ice_for_each_vsi(pf, v) | 3194 | ice_for_each_vsi(pf, v) |
3190 | if (pf->vsi[v]) | 3195 | if (pf->vsi[v]) |
3191 | ice_dis_vsi(pf->vsi[v]); | 3196 | ice_dis_vsi(pf->vsi[v], false); |
3192 | } | 3197 | } |
3193 | 3198 | ||
3194 | /** | 3199 | /** |