aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Smart <James.Smart@Emulex.Com>2006-03-08 14:50:12 -0500
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-06-27 11:48:11 -0400
commitd7a1bb0a04ca835bffc0a91e64ab827dfba7d8f5 (patch)
treef944d6ed6ecf23c59054b7f459e88f31f8da4235
parent12e9b5fb96028aab26af65bb06d2dee56c428a6e (diff)
[SCSI] Block I/O while SG reset operation in progress - the midlayer patch
The scsi midlayer portion of the patch Signed-off-by: James Smart <James.Smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r--drivers/scsi/scsi_error.c22
-rw-r--r--include/scsi/scsi_host.h6
2 files changed, 27 insertions, 1 deletions
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 6a7a60fc0a4e..6683d596234a 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -1672,7 +1672,9 @@ int
1672scsi_reset_provider(struct scsi_device *dev, int flag) 1672scsi_reset_provider(struct scsi_device *dev, int flag)
1673{ 1673{
1674 struct scsi_cmnd *scmd = scsi_get_command(dev, GFP_KERNEL); 1674 struct scsi_cmnd *scmd = scsi_get_command(dev, GFP_KERNEL);
1675 struct Scsi_Host *shost = dev->host;
1675 struct request req; 1676 struct request req;
1677 unsigned long flags;
1676 int rtn; 1678 int rtn;
1677 1679
1678 scmd->request = &req; 1680 scmd->request = &req;
@@ -1699,6 +1701,10 @@ scsi_reset_provider(struct scsi_device *dev, int flag)
1699 */ 1701 */
1700 scmd->pid = 0; 1702 scmd->pid = 0;
1701 1703
1704 spin_lock_irqsave(shost->host_lock, flags);
1705 shost->tmf_in_progress = 1;
1706 spin_unlock_irqrestore(shost->host_lock, flags);
1707
1702 switch (flag) { 1708 switch (flag) {
1703 case SCSI_TRY_RESET_DEVICE: 1709 case SCSI_TRY_RESET_DEVICE:
1704 rtn = scsi_try_bus_device_reset(scmd); 1710 rtn = scsi_try_bus_device_reset(scmd);
@@ -1717,6 +1723,22 @@ scsi_reset_provider(struct scsi_device *dev, int flag)
1717 rtn = FAILED; 1723 rtn = FAILED;
1718 } 1724 }
1719 1725
1726 spin_lock_irqsave(shost->host_lock, flags);
1727 shost->tmf_in_progress = 0;
1728 spin_unlock_irqrestore(shost->host_lock, flags);
1729
1730 /*
1731 * be sure to wake up anyone who was sleeping or had their queue
1732 * suspended while we performed the TMF.
1733 */
1734 SCSI_LOG_ERROR_RECOVERY(3,
1735 printk("%s: waking up host to restart after TMF\n",
1736 __FUNCTION__));
1737
1738 wake_up(&shost->host_wait);
1739
1740 scsi_run_host_queues(shost);
1741
1720 scsi_next_command(scmd); 1742 scsi_next_command(scmd);
1721 return rtn; 1743 return rtn;
1722} 1744}
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index a42efd6e4be8..b3dd90f3e858 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -542,6 +542,9 @@ struct Scsi_Host {
542 */ 542 */
543 unsigned ordered_tag:1; 543 unsigned ordered_tag:1;
544 544
545 /* task mgmt function in progress */
546 unsigned tmf_in_progress:1;
547
545 /* 548 /*
546 * Optional work queue to be utilized by the transport 549 * Optional work queue to be utilized by the transport
547 */ 550 */
@@ -619,7 +622,8 @@ static inline int scsi_host_in_recovery(struct Scsi_Host *shost)
619{ 622{
620 return shost->shost_state == SHOST_RECOVERY || 623 return shost->shost_state == SHOST_RECOVERY ||
621 shost->shost_state == SHOST_CANCEL_RECOVERY || 624 shost->shost_state == SHOST_CANCEL_RECOVERY ||
622 shost->shost_state == SHOST_DEL_RECOVERY; 625 shost->shost_state == SHOST_DEL_RECOVERY ||
626 shost->tmf_in_progress;
623} 627}
624 628
625extern int scsi_queue_work(struct Scsi_Host *, struct work_struct *); 629extern int scsi_queue_work(struct Scsi_Host *, struct work_struct *);