aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/mpt2sas
diff options
context:
space:
mode:
authorKashyap, Desai <kashyap.desai@lsi.com>2010-03-30 01:22:44 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-04-11 14:27:01 -0400
commit1469585309bb52869cbaa449c6d2cd1ce9869cca (patch)
tree111af0cfae42fbaa9bacb07327c185c1eb9ad0f9 /drivers/scsi/mpt2sas
parentf87146bba523cad0196aa8e80ca9e8243d7a6c0c (diff)
[SCSI] mpt2sas : IOs needs to be pause until handles are refreshed for all device after recovery
After Host Reset firmware will have new list of device handles for the target. Device handle refresh in driver is part of Rescan topology logic. (See functions like *_search_responding_*). This needs to be done from Host Reset context before making shost_recovery to 0. Currently it is done in Firwmare event context, which may leads IO to a wrong device. Now handler refresh is moved to HBA reset context. Apart from this, Now driver will stop IOs for all device setting deleted flag to 1 at the time of HBA Reset through _scsih_prep_device_scan. It will only unblock devices, if devices has been found as part of RESCAN. This way it will make more safe IO blocking at the time of HBA reset at mpt2sas driver layer. Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/mpt2sas')
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_scsih.c49
1 files changed, 40 insertions, 9 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index b0d598ec71c0..1f0466aa6c18 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -5506,6 +5506,26 @@ _scsih_task_set_full(struct MPT2SAS_ADAPTER *ioc, struct fw_event_work
5506} 5506}
5507 5507
5508/** 5508/**
5509 * _scsih_prep_device_scan - initialize parameters prior to device scan
5510 * @ioc: per adapter object
5511 *
5512 * Set the deleted flag prior to device scan. If the device is found during
5513 * the scan, then we clear the deleted flag.
5514 */
5515static void
5516_scsih_prep_device_scan(struct MPT2SAS_ADAPTER *ioc)
5517{
5518 struct MPT2SAS_DEVICE *sas_device_priv_data;
5519 struct scsi_device *sdev;
5520
5521 shost_for_each_device(sdev, ioc->shost) {
5522 sas_device_priv_data = sdev->hostdata;
5523 if (sas_device_priv_data && sas_device_priv_data->sas_target)
5524 sas_device_priv_data->sas_target->deleted = 1;
5525 }
5526}
5527
5528/**
5509 * _scsih_mark_responding_sas_device - mark a sas_devices as responding 5529 * _scsih_mark_responding_sas_device - mark a sas_devices as responding
5510 * @ioc: per adapter object 5530 * @ioc: per adapter object
5511 * @sas_address: sas address 5531 * @sas_address: sas address
@@ -5532,8 +5552,12 @@ _scsih_mark_responding_sas_device(struct MPT2SAS_ADAPTER *ioc, u64 sas_address,
5532 sas_device->slot == slot && sas_device->starget) { 5552 sas_device->slot == slot && sas_device->starget) {
5533 sas_device->responding = 1; 5553 sas_device->responding = 1;
5534 starget = sas_device->starget; 5554 starget = sas_device->starget;
5535 sas_target_priv_data = starget->hostdata; 5555 if (starget && starget->hostdata) {
5536 sas_target_priv_data->tm_busy = 0; 5556 sas_target_priv_data = starget->hostdata;
5557 sas_target_priv_data->tm_busy = 0;
5558 sas_target_priv_data->deleted = 0;
5559 } else
5560 sas_target_priv_data = NULL;
5537 starget_printk(KERN_INFO, sas_device->starget, 5561 starget_printk(KERN_INFO, sas_device->starget,
5538 "handle(0x%04x), sas_addr(0x%016llx), enclosure " 5562 "handle(0x%04x), sas_addr(0x%016llx), enclosure "
5539 "logical id(0x%016llx), slot(%d)\n", handle, 5563 "logical id(0x%016llx), slot(%d)\n", handle,
@@ -5546,7 +5570,8 @@ _scsih_mark_responding_sas_device(struct MPT2SAS_ADAPTER *ioc, u64 sas_address,
5546 printk(KERN_INFO "\thandle changed from(0x%04x)!!!\n", 5570 printk(KERN_INFO "\thandle changed from(0x%04x)!!!\n",
5547 sas_device->handle); 5571 sas_device->handle);
5548 sas_device->handle = handle; 5572 sas_device->handle = handle;
5549 sas_target_priv_data->handle = handle; 5573 if (sas_target_priv_data)
5574 sas_target_priv_data->handle = handle;
5550 goto out; 5575 goto out;
5551 } 5576 }
5552 } 5577 }
@@ -5621,6 +5646,12 @@ _scsih_mark_responding_raid_device(struct MPT2SAS_ADAPTER *ioc, u64 wwid,
5621 spin_lock_irqsave(&ioc->raid_device_lock, flags); 5646 spin_lock_irqsave(&ioc->raid_device_lock, flags);
5622 list_for_each_entry(raid_device, &ioc->raid_device_list, list) { 5647 list_for_each_entry(raid_device, &ioc->raid_device_list, list) {
5623 if (raid_device->wwid == wwid && raid_device->starget) { 5648 if (raid_device->wwid == wwid && raid_device->starget) {
5649 starget = raid_device->starget;
5650 if (starget && starget->hostdata) {
5651 sas_target_priv_data = starget->hostdata;
5652 sas_target_priv_data->deleted = 0;
5653 } else
5654 sas_target_priv_data = NULL;
5624 raid_device->responding = 1; 5655 raid_device->responding = 1;
5625 starget_printk(KERN_INFO, raid_device->starget, 5656 starget_printk(KERN_INFO, raid_device->starget,
5626 "handle(0x%04x), wwid(0x%016llx)\n", handle, 5657 "handle(0x%04x), wwid(0x%016llx)\n", handle,
@@ -5630,9 +5661,8 @@ _scsih_mark_responding_raid_device(struct MPT2SAS_ADAPTER *ioc, u64 wwid,
5630 printk(KERN_INFO "\thandle changed from(0x%04x)!!!\n", 5661 printk(KERN_INFO "\thandle changed from(0x%04x)!!!\n",
5631 raid_device->handle); 5662 raid_device->handle);
5632 raid_device->handle = handle; 5663 raid_device->handle = handle;
5633 starget = raid_device->starget; 5664 if (sas_target_priv_data)
5634 sas_target_priv_data = starget->hostdata; 5665 sas_target_priv_data->handle = handle;
5635 sas_target_priv_data->handle = handle;
5636 goto out; 5666 goto out;
5637 } 5667 }
5638 } 5668 }
@@ -5857,6 +5887,10 @@ mpt2sas_scsih_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase)
5857 dtmprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s: " 5887 dtmprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s: "
5858 "MPT2_IOC_DONE_RESET\n", ioc->name, __func__)); 5888 "MPT2_IOC_DONE_RESET\n", ioc->name, __func__));
5859 _scsih_sas_host_refresh(ioc); 5889 _scsih_sas_host_refresh(ioc);
5890 _scsih_prep_device_scan(ioc);
5891 _scsih_search_responding_sas_devices(ioc);
5892 _scsih_search_responding_raid_devices(ioc);
5893 _scsih_search_responding_expanders(ioc);
5860 break; 5894 break;
5861 } 5895 }
5862} 5896}
@@ -5894,9 +5928,6 @@ _firmware_event_work(struct work_struct *work)
5894 } else 5928 } else
5895 spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, 5929 spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock,
5896 flags); 5930 flags);
5897 _scsih_search_responding_sas_devices(ioc);
5898 _scsih_search_responding_raid_devices(ioc);
5899 _scsih_search_responding_expanders(ioc);
5900 _scsih_remove_unresponding_sas_devices(ioc); 5931 _scsih_remove_unresponding_sas_devices(ioc);
5901 return; 5932 return;
5902 } 5933 }