Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Mar 2019 09:16:29 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r344919 - head/sys/dev/mlx4/mlx4_en
Message-ID:  <201903080916.x289GTT5054261@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Fri Mar  8 09:16:29 2019
New Revision: 344919
URL: https://svnweb.freebsd.org/changeset/base/344919

Log:
  Don't hold state lock while detaching network device instance in mlx4en(4).
  
  It can happen during shutdown that the lock will recurse when the mlx4en(4)
  instance is part of a lagg interface. Call ether_ifdetach() unlocked.
  
  Backtrace:
  panic(): _sx_xlock_hard: recursed on non-recursive sx &mdev->state_lock
  _sx_xlock_hard()
  _sx_xlock()
  mlx4_en_ioctl()
  if_setlladdr()
  lagg_port_destroy()
  lagg_port_ifdetach()
  if_detach()
  mlx4_en_destroy_netdev()
  mlx4_en_remove()
  mlx4_remove_device()
  mlx4_unregister_device()
  mlx4_unload_one()
  mlx4_shutdown()
  linux_pci_shutdown()
  bus_generic_shutdown()
  
  MFC after:		1 week
  Sponsored by:		Mellanox Technologies

Modified:
  head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c

Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
==============================================================================
--- head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c	Fri Mar  8 08:27:33 2019	(r344918)
+++ head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c	Fri Mar  8 09:16:29 2019	(r344919)
@@ -1779,11 +1779,8 @@ void mlx4_en_destroy_netdev(struct net_device *dev)
 		EVENTHANDLER_DEREGISTER(vlan_unconfig, priv->vlan_detach);
 
 	/* Unregister device - this will close the port if it was up */
-	if (priv->registered) {
-		mutex_lock(&mdev->state_lock);
+	if (priv->registered)
 		ether_ifdetach(dev);
-		mutex_unlock(&mdev->state_lock);
-	}
 
 	mutex_lock(&mdev->state_lock);
 	mlx4_en_stop_port(dev);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903080916.x289GTT5054261>