public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Love <robert.w.love@intel.com>
To: linux-scsi@vger.kernel.org
Cc: Ross Brattain <ross.b.brattain@intel.com>,
	Neil Horman <nhorman@tuxdriver.com>,
	Vasu Dev <vasu.dev@intel.com>
Subject: [PATCH 3/6] libfc: defer releasing master lport until complete fcoe interface cleanuped up
Date: Fri, 20 Apr 2012 12:16:38 -0700	[thread overview]
Message-ID: <20120420191638.4634.43311.stgit@localhost6.localdomain6> (raw)
In-Reply-To: <20120420191620.4634.94869.stgit@localhost6.localdomain6>

From: Vasu Dev <vasu.dev@intel.com>

The fcoe controller has back references, therefore defer
releasing master lport which gets freed along scsi_host_put
and then free it once fcoe interface is fully cleaned.

Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
 drivers/scsi/fcoe/fcoe.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 09a6a26..481ba6f 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -472,6 +472,7 @@ static void fcoe_interface_cleanup(struct fcoe_interface *fcoe)
 	/* Release the self-reference taken during fcoe_interface_create() */
 	/* tear-down the FCoE controller */
 	fcoe_ctlr_destroy(fip);
+	scsi_host_put(fcoe->ctlr.lp->host);
 	kfree(fcoe);
 	dev_put(netdev);
 	module_put(THIS_MODULE);
@@ -976,8 +977,12 @@ static void fcoe_if_destroy(struct fc_lport *lport)
 	/* Free memory used by statistical counters */
 	fc_lport_free_stats(lport);
 
-	/* Release the Scsi_Host */
-	scsi_host_put(lport->host);
+	/*
+	 * Release the Scsi_Host for vport but hold on to
+	 * master lport until it fcoe interface fully cleaned-up.
+	 */
+	if (lport->vport)
+		scsi_host_put(lport->host);
 }
 
 /**


  parent reply	other threads:[~2012-04-20 19:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-20 19:16 [PATCH 0/6] libfc, libfcoe and fcoe patches for scsi-misc Robert Love
2012-04-20 19:16 ` [PATCH 1/6] fcoe: remove lport from net device before doing per cpu rx thread cleanup Robert Love
2012-04-20 19:16 ` [PATCH 2/6] libfc: flush lport worker after its disabled Robert Love
2012-04-20 19:16 ` Robert Love [this message]
2012-04-20 19:16 ` [PATCH 4/6] fcoe: Don't hold rtnl_mutex in fcoe_update_src_mac Robert Love
2012-05-10  7:53   ` James Bottomley
2012-04-20 19:16 ` [PATCH 5/6] libfcoe: fix VN2VN N_Port_ID Beacon source MAC Robert Love
2012-04-20 19:16 ` [PATCH 6/6] fcoe: remove a stray unlock Robert Love

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=20120420191638.4634.43311.stgit@localhost6.localdomain6 \
    --to=robert.w.love@intel.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=ross.b.brattain@intel.com \
    --cc=vasu.dev@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox