diff mbox

[1/3] fcoe: move fcoe_interface_remove() out of fcoe_interface_cleanup()

Message ID 1504171174-37989-2-git-send-email-hare@suse.de (mailing list archive)
State Changes Requested
Headers show

Commit Message

Hannes Reinecke Aug. 31, 2017, 9:19 a.m. UTC
No functional change.

Signed-off-by: Hannes Reinecke <hare@suse.com>
---
 drivers/scsi/fcoe/fcoe.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

Comments

Lee Duncan Sept. 10, 2017, 5:37 p.m. UTC | #1
On 08/31/2017 02:19 AM, Hannes Reinecke wrote:
> No functional change.

Nit: Then why do it? Perhaps the description can say why such a change
is being done?

> 
> Signed-off-by: Hannes Reinecke <hare@suse.com>
> ---
>  drivers/scsi/fcoe/fcoe.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
> index 85f9a3e..135bdcf 100644
> --- a/drivers/scsi/fcoe/fcoe.c
> +++ b/drivers/scsi/fcoe/fcoe.c
> @@ -501,11 +501,6 @@ static void fcoe_interface_cleanup(struct fcoe_interface *fcoe)
>  	struct net_device *netdev = fcoe->netdev;
>  	struct fcoe_ctlr *fip = fcoe_to_ctlr(fcoe);
>  
> -	rtnl_lock();
> -	if (!fcoe->removed)
> -		fcoe_interface_remove(fcoe);
> -	rtnl_unlock();
> -
>  	/* Release the self-reference taken during fcoe_interface_create() */
>  	/* tear-down the FCoE controller */
>  	fcoe_ctlr_destroy(fip);
> @@ -2140,6 +2135,11 @@ static void fcoe_destroy_work(struct work_struct *work)
>  	cdev = fcoe_ctlr_to_ctlr_dev(ctlr);
>  
>  	fcoe_if_destroy(port->lport);
> +
> +	rtnl_lock();
> +	if (!fcoe->removed)
> +		fcoe_interface_remove(fcoe);
> +	rtnl_unlock();
>  	fcoe_interface_cleanup(fcoe);
>  
>  	mutex_unlock(&fcoe_config_mutex);
> @@ -2254,6 +2254,8 @@ static int _fcoe_create(struct net_device *netdev, enum fip_mode fip_mode,
>  		printk(KERN_ERR "fcoe: Failed to create interface (%s)\n",
>  		       netdev->name);
>  		rc = -EIO;
> +		if (!fcoe->removed)
> +			fcoe_interface_remove(fcoe);
>  		rtnl_unlock();
>  		fcoe_interface_cleanup(fcoe);
>  		mutex_unlock(&fcoe_config_mutex);
> 

Looks good to me (other than the comment nit).

Reviewed-by: Lee Duncan <lduncan@suse.com>
Johannes Thumshirn Sept. 11, 2017, 8:15 a.m. UTC | #2
With an updates patch description (see Lee's mail) 

Acked-by: Johannes Thumshirn <jth@kernel.org>
diff mbox

Patch

diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 85f9a3e..135bdcf 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -501,11 +501,6 @@  static void fcoe_interface_cleanup(struct fcoe_interface *fcoe)
 	struct net_device *netdev = fcoe->netdev;
 	struct fcoe_ctlr *fip = fcoe_to_ctlr(fcoe);
 
-	rtnl_lock();
-	if (!fcoe->removed)
-		fcoe_interface_remove(fcoe);
-	rtnl_unlock();
-
 	/* Release the self-reference taken during fcoe_interface_create() */
 	/* tear-down the FCoE controller */
 	fcoe_ctlr_destroy(fip);
@@ -2140,6 +2135,11 @@  static void fcoe_destroy_work(struct work_struct *work)
 	cdev = fcoe_ctlr_to_ctlr_dev(ctlr);
 
 	fcoe_if_destroy(port->lport);
+
+	rtnl_lock();
+	if (!fcoe->removed)
+		fcoe_interface_remove(fcoe);
+	rtnl_unlock();
 	fcoe_interface_cleanup(fcoe);
 
 	mutex_unlock(&fcoe_config_mutex);
@@ -2254,6 +2254,8 @@  static int _fcoe_create(struct net_device *netdev, enum fip_mode fip_mode,
 		printk(KERN_ERR "fcoe: Failed to create interface (%s)\n",
 		       netdev->name);
 		rc = -EIO;
+		if (!fcoe->removed)
+			fcoe_interface_remove(fcoe);
 		rtnl_unlock();
 		fcoe_interface_cleanup(fcoe);
 		mutex_unlock(&fcoe_config_mutex);