linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Narsimhulu Musini <nmusini@cisco.com>
To: James.Bottomley@HansenPartnership.com,
	linux-scsi@vger.kernel.org, hare@suse.de
Cc: Narsimhulu Musini <nmusini@cisco.com>,
	Sesidhar Baddela <sebaddel@cisco.com>
Subject: [PATCH 4/8] snic: target cleanup in driver unload path
Date: Thu, 17 Mar 2016 00:51:13 -0700	[thread overview]
Message-ID: <1458201077-10211-4-git-send-email-nmusini@cisco.com> (raw)
In-Reply-To: <1458201077-10211-1-git-send-email-nmusini@cisco.com>

Fix deletes the snic targets synchronously prior to deletion of host.

Signed-off-by: Narsimhulu Musini <nmusini@cisco.com>
Signed-off-by: Sesidhar Baddela <sebaddel@cisco.com>
---
 drivers/scsi/snic/snic_disc.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/snic/snic_disc.c b/drivers/scsi/snic/snic_disc.c
index 5f63217..c46960c 100644
--- a/drivers/scsi/snic/snic_disc.c
+++ b/drivers/scsi/snic/snic_disc.c
@@ -480,10 +480,21 @@ int
 snic_disc_start(struct snic *snic)
 {
 	struct snic_disc *disc = &snic->disc;
+	unsigned long flags;
 	int ret = 0;
 
 	SNIC_SCSI_DBG(snic->shost, "Discovery Start.\n");
 
+	spin_lock_irqsave(&snic->snic_lock, flags);
+	if (snic->in_remove) {
+		spin_unlock_irqrestore(&snic->snic_lock, flags);
+		SNIC_ERR("snic driver removal in progress ...\n");
+		ret = 0;
+
+		return ret;
+	}
+	spin_unlock_irqrestore(&snic->snic_lock, flags);
+
 	mutex_lock(&disc->mutex);
 	if (disc->state == SNIC_DISC_PENDING) {
 		disc->req_cnt++;
@@ -533,6 +544,8 @@ snic_tgt_del_all(struct snic *snic)
 	struct list_head *cur, *nxt;
 	unsigned long flags;
 
+	scsi_flush_work(snic->shost);
+
 	mutex_lock(&snic->disc.mutex);
 	spin_lock_irqsave(snic->shost->host_lock, flags);
 
@@ -545,7 +558,7 @@ snic_tgt_del_all(struct snic *snic)
 		tgt = NULL;
 	}
 	spin_unlock_irqrestore(snic->shost->host_lock, flags);
-
-	scsi_flush_work(snic->shost);
 	mutex_unlock(&snic->disc.mutex);
+
+	flush_workqueue(snic_glob->event_q);
 } /* end of snic_tgt_del_all */
-- 
1.8.5.4


  parent reply	other threads:[~2016-03-17  7:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-17  7:51 [PATCH 1/8] snic: Added additional stats Narsimhulu Musini
2016-03-17  7:51 ` [PATCH 2/8] snic: LUN goes offline due to scsi cmd timeouts Narsimhulu Musini
2016-04-05  2:05   ` Martin K. Petersen
2016-03-17  7:51 ` [PATCH 3/8] snic: Handling control path queue issues Narsimhulu Musini
2016-03-17  7:51 ` Narsimhulu Musini [this message]
2016-03-17  7:51 ` [PATCH 5/8] snic: Fix for missing interrupts Narsimhulu Musini
2016-03-17  7:51 ` [PATCH 6/8] snic: Fixing race in the hba reset and IO/TM completion Narsimhulu Musini
2016-03-17  7:51 ` [PATCH 7/8] snic: add scsi host after determining max IOs Narsimhulu Musini
2016-03-17  7:51 ` [PATCH 8/8] snic: updating driver version Narsimhulu Musini

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=1458201077-10211-4-git-send-email-nmusini@cisco.com \
    --to=nmusini@cisco.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=hare@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sebaddel@cisco.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;
as well as URLs for NNTP newsgroup(s).