[Open-FCoE] [RFC PATCH 3/3] bnx2fc: Return ERESTARTSYS on rtnl_lock failure

Bhanu Gollapudi bprakash at broadcom.com
Tue Jan 11 03:18:53 UTC 2011


bnx2fc driver should return -ERESTARTSYS instead of -ENODEV so
that rtnl lock will be retried.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash at broadcom.com>
---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |   22 ++++++++--------------
 1 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index ea846ee..b24aa75 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -1489,7 +1489,7 @@ static int bnx2fc_destroy(struct net_device *netdev)
 	int rc = 0;
 
 	if (!rtnl_trylock())
-		return restart_syscall();
+		return -ERESTARTSYS;
 
 	mutex_lock(&bnx2fc_dev_lock);
 #ifdef CONFIG_SCSI_BNX2X_FCOE_MODULE
@@ -1839,10 +1839,8 @@ static int bnx2fc_disable(struct net_device *netdev)
 	struct ethtool_drvinfo drvinfo;
 	int rc = 0;
 
-	if (!rtnl_trylock()) {
-		printk(KERN_ERR PFX "retrying for rtnl_lock\n");
-		return -EIO;
-	}
+	if (!rtnl_trylock())
+		return -ERESTARTSYS;
 
 	mutex_lock(&bnx2fc_dev_lock);
 
@@ -1901,10 +1899,8 @@ static int bnx2fc_enable(struct net_device *netdev)
 	struct ethtool_drvinfo drvinfo;
 	int rc = 0;
 
-	if (!rtnl_trylock()) {
-		printk(KERN_ERR PFX "retrying for rtnl_lock\n");
-		return -EIO;
-	}
+	if (!rtnl_trylock())
+		return -ERESTARTSYS;
 
 	mutex_lock(&bnx2fc_dev_lock);
 
@@ -1969,11 +1965,9 @@ static int bnx2fc_create(struct net_device *netdev, enum fip_state fip_mode)
 	int rc = 0;
 	int vlan_id;
 
-	bnx2fc_dbg(LOG_INIT, "Entered bnx2fc_create\n");
-	if (!rtnl_trylock()) {
-		printk(KERN_ERR "trying for rtnl_lock\n");
-		return -EIO;
-	}
+	if (!rtnl_trylock())
+		return -ERESTARTSYS;
+
 	mutex_lock(&bnx2fc_dev_lock);
 
 #ifdef CONFIG_SCSI_BNX2X_FCOE_MODULE
-- 
1.7.0.6







More information about the devel mailing list