linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian King <brking@linux.vnet.ibm.com>
To: Tejun Heo <tj@kernel.org>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	linux-ide <linux-ide@vger.kernel.org>
Subject: [RFC] [PATCH 1/3] ipr: Wait to do async scan until scsi host is initialized
Date: Fri, 10 Jun 2016 16:36:46 -0500	[thread overview]
Message-ID: <575B32EE.8080403@linux.vnet.ibm.com> (raw)
In-Reply-To: <575B3215.5070602@linux.vnet.ibm.com>


When performing an async scan, make sure the kthread doing scanning
doesn't start before the scsi host is fully initialized.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
---

 drivers/scsi/ipr.c |    9 +++++++++
 drivers/scsi/ipr.h |    1 +
 2 files changed, 10 insertions(+)

diff -puN drivers/scsi/ipr.c~ipr_async_scan_fixup drivers/scsi/ipr.c
--- linux-2.6.git/drivers/scsi/ipr.c~ipr_async_scan_fixup	2016-06-01 21:04:14.088698640 -0500
+++ linux-2.6.git-bjking1/drivers/scsi/ipr.c	2016-06-10 15:35:56.738201739 -0500
@@ -3287,6 +3287,11 @@ static void ipr_worker_thread(struct wor
 		return;
 	}
 
+	if (!ioa_cfg->scan_enabled) {
+		spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+		return;
+	}
+
 restart:
 	do {
 		did_work = 0;
@@ -10360,6 +10365,7 @@ static void ipr_remove(struct pci_dev *p
 static int ipr_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
 {
 	struct ipr_ioa_cfg *ioa_cfg;
+	unsigned long flags;
 	int rc, i;
 
 	rc = ipr_probe_ioa(pdev, dev_id);
@@ -10412,7 +10418,10 @@ static int ipr_probe(struct pci_dev *pde
 		}
 	}
 
+	spin_lock_irqsave(ioa_cfg->host->host_lock, flags);
+	ioa_cfg->scan_enabled = 1;
 	schedule_work(&ioa_cfg->work_q);
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, flags);
 	return 0;
 }
 
diff -puN drivers/scsi/ipr.h~ipr_async_scan_fixup drivers/scsi/ipr.h
--- linux-2.6.git/drivers/scsi/ipr.h~ipr_async_scan_fixup	2016-06-01 21:04:17.186678232 -0500
+++ linux-2.6.git-bjking1/drivers/scsi/ipr.h	2016-06-10 15:35:56.739201727 -0500
@@ -1475,6 +1475,7 @@ struct ipr_ioa_cfg {
 	u8 in_ioa_bringdown:1;
 	u8 ioa_unit_checked:1;
 	u8 dump_taken:1;
+	u8 scan_enabled:1;
 	u8 scan_done:1;
 	u8 needs_hard_reset:1;
 	u8 dual_raid:1;
_


  reply	other threads:[~2016-06-10 21:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-25 19:32 Converting ipr to use ata_port_operations->error_handler Tejun Heo
2016-05-26 14:12 ` Brian King
2016-06-10 21:33   ` [RFC] [PATCH 0/3] Convert " Brian King
2016-06-10 21:36     ` Brian King [this message]
2016-06-10 21:37     ` [RFC] [PATCH 2/3] scsi: Export SCSI EH commands Brian King
2016-06-10 21:39     ` [RFC] [PATCH 3/3] ipr: Use libata new EH Brian King
2016-06-13 22:15     ` [RFC] [PATCH 0/3] Convert ipr to use ata_port_operations->error_handler Tejun Heo

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=575B32EE.8080403@linux.vnet.ibm.com \
    --to=brking@linux.vnet.ibm.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=tj@kernel.org \
    /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).