aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/mpt2sas
diff options
context:
space:
mode:
authornagalakshmi.nandigama@lsi.com <nagalakshmi.nandigama@lsi.com>2011-10-19 06:07:00 -0400
committerJames Bottomley <JBottomley@Parallels.com>2011-10-30 04:48:34 -0400
commitf881ceadd4d6afafb227bcf8165c1b63ba90065b (patch)
treedc41f0735580efb7f10f8ac2d5e314e29ec1e360 /drivers/scsi/mpt2sas
parent24f09b598dc455be84991e69ab9e6a339fd66bcf (diff)
[SCSI] mpt2sas: Fix drives not getting properly deleted if sas cable is removed while host reset is active
The fix is in the driver-firmware handshake device removal code. We need to read the controller ioc_state to see if controller is OPERATIONAL prior to sending target reset and OP_REMOVE. Previously it was checking the flag ioc->shost_recovery flag, which is always set when host reset is active, thus preventing drives from getting properly deleted. Signed-off-by: Nagalakshmi Nandigama <nagalakshmi.nandigama@lsi.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/mpt2sas')
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_scsih.c38
1 files changed, 30 insertions, 8 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index 8a9c70f21ecd..cd89f42440fe 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -3019,11 +3019,23 @@ _scsih_tm_tr_send(struct MPT2SAS_ADAPTER *ioc, u16 handle)
3019 struct MPT2SAS_TARGET *sas_target_priv_data; 3019 struct MPT2SAS_TARGET *sas_target_priv_data;
3020 unsigned long flags; 3020 unsigned long flags;
3021 struct _tr_list *delayed_tr; 3021 struct _tr_list *delayed_tr;
3022 u32 ioc_state;
3022 3023
3023 if (ioc->shost_recovery || ioc->remove_host || 3024 if (ioc->remove_host) {
3024 ioc->pci_error_recovery) { 3025 dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: host has been "
3025 dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: host reset in " 3026 "removed: handle(0x%04x)\n", __func__, ioc->name, handle));
3026 "progress!\n", __func__, ioc->name)); 3027 return;
3028 } else if (ioc->pci_error_recovery) {
3029 dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: host in pci "
3030 "error recovery: handle(0x%04x)\n", __func__, ioc->name,
3031 handle));
3032 return;
3033 }
3034 ioc_state = mpt2sas_base_get_iocstate(ioc, 1);
3035 if (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
3036 dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: host is not "
3037 "operational: handle(0x%04x)\n", __func__, ioc->name,
3038 handle));
3027 return; 3039 return;
3028 } 3040 }
3029 3041
@@ -3224,11 +3236,21 @@ _scsih_tm_tr_complete(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
3224 mpt2sas_base_get_reply_virt_addr(ioc, reply); 3236 mpt2sas_base_get_reply_virt_addr(ioc, reply);
3225 Mpi2SasIoUnitControlRequest_t *mpi_request; 3237 Mpi2SasIoUnitControlRequest_t *mpi_request;
3226 u16 smid_sas_ctrl; 3238 u16 smid_sas_ctrl;
3239 u32 ioc_state;
3227 3240
3228 if (ioc->shost_recovery || ioc->remove_host || 3241 if (ioc->remove_host) {
3229 ioc->pci_error_recovery) { 3242 dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: host has been "
3230 dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: host reset in " 3243 "removed\n", __func__, ioc->name));
3231 "progress!\n", __func__, ioc->name)); 3244 return 1;
3245 } else if (ioc->pci_error_recovery) {
3246 dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: host in pci "
3247 "error recovery\n", __func__, ioc->name));
3248 return 1;
3249 }
3250 ioc_state = mpt2sas_base_get_iocstate(ioc, 1);
3251 if (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
3252 dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: host is not "
3253 "operational\n", __func__, ioc->name));
3232 return 1; 3254 return 1;
3233 } 3255 }
3234 3256