All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Bhanu Prakash Gollapudi" <bprakash@broadcom.com>
To: JBottomley@parallels.com, linux-scsi@vger.kernel.org
Cc: michaelc@cs.wisc.edu, mchan@broadcom.com, nsujir@broadcom.com,
	Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Subject: [PATCH 5/8] bnx2fc: Avoid calling bnx2fc_if_destroy with unnecessary locks
Date: Tue, 30 Aug 2011 15:54:51 -0700	[thread overview]
Message-ID: <1314744894-24710-6-git-send-email-bprakash@broadcom.com> (raw)
In-Reply-To: <1314744894-24710-1-git-send-email-bprakash@broadcom.com>

It is not required to hold rtnl_lock and bnx2fc_dev_lock when calling
bnx2fc_if_destroy, as the locking is only required to serialize creation and
deletion of fcoe instances. More importantly, this unnecessary locking causes
deadlock as bnx2fc_if_destroy calls fc_remove_host holding rtnl_lock.

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

diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 886938d..a5111f3 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -1487,13 +1487,13 @@ static void bnx2fc_if_destroy(struct fc_lport *lport)
 static void __bnx2fc_destroy(struct bnx2fc_interface *interface)
 {
 	struct fc_lport *lport = interface->ctlr.lp;
+	struct fcoe_port *port = lport_priv(lport);
 
 	bnx2fc_interface_cleanup(interface);
 	bnx2fc_stop(interface);
 	list_del(&interface->list);
-	lport = interface->ctlr.lp;
 	bnx2fc_interface_put(interface);
-	bnx2fc_if_destroy(lport);
+	queue_work(bnx2fc_wq, &port->destroy_work);
 }
 
 /**
@@ -1541,11 +1541,7 @@ static void bnx2fc_destroy_work(struct work_struct *work)
 
 	BNX2FC_HBA_DBG(lport, "Entered bnx2fc_destroy_work\n");
 
-	rtnl_lock();
-	mutex_lock(&bnx2fc_dev_lock);
 	bnx2fc_if_destroy(lport);
-	mutex_unlock(&bnx2fc_dev_lock);
-	rtnl_unlock();
 }
 
 static void bnx2fc_unbind_adapter_devices(struct bnx2fc_hba *hba)
-- 
1.7.0.6



  parent reply	other threads:[~2011-08-30 22:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-30 22:54 [PATCH 0/8] bnx2fc version 1.0.6 Bhanu Prakash Gollapudi
2011-08-30 22:54 ` [PATCH 1/8] bnx2fc: Reset max receive frame size during link up Bhanu Prakash Gollapudi
2011-08-30 22:54 ` [PATCH 2/8] bnx2fc: Send solicitation only after vlan discovery is complete Bhanu Prakash Gollapudi
2011-08-30 22:54 ` [PATCH 3/8] bnx2fc: No abort issued for REC when it times out Bhanu Prakash Gollapudi
2011-08-30 22:54 ` [PATCH 4/8] bnx2fc: Validate vlan id in NETDEV_UNREGISTER handler Bhanu Prakash Gollapudi
2011-08-30 22:54 ` Bhanu Prakash Gollapudi [this message]
2011-08-30 22:54 ` [PATCH 6/8] bnx2fc: Fix panic caused because of incorrect errror handling in create() Bhanu Prakash Gollapudi
2011-08-30 22:54 ` [PATCH 7/8] bnx2fc: Fix FW assert during RSCN stress tests Bhanu Prakash Gollapudi
2011-08-30 22:54 ` [PATCH 8/8] bnx2fc: Bumped version to 1.0.6 Bhanu Prakash Gollapudi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1314744894-24710-6-git-send-email-bprakash@broadcom.com \
    --to=bprakash@broadcom.com \
    --cc=JBottomley@parallels.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mchan@broadcom.com \
    --cc=michaelc@cs.wisc.edu \
    --cc=nsujir@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.