Skip to content

Commit 82b2fb5

Browse files
hreineckemartinkpetersen
authored andcommitted
scsi: mpi3mr: Split off bus_reset function from host_reset
SCSI EH host reset is the final callback in the escalation chain; once we reach this we need to reset the controller. As such it defeats the purpose to skip controller reset if no I/Os are pending and the RAID device is to be reset; especially after kexec there might be stale commands pending in firmware for which we have no reference whatsoever. So this patch splits off the check for pending I/O into a 'bus_reset' function, and leaves the actual controller reset to the host reset. Signed-off-by: Hannes Reinecke <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: Kashyap Desai <[email protected]> Cc: Sathya Prakash Veerichetty <[email protected]> Cc: Sumit Saxena <[email protected]> Cc: Sreekanth Reddy <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent c2a14ab commit 82b2fb5

File tree

1 file changed

+37
-20
lines changed

1 file changed

+37
-20
lines changed

drivers/scsi/mpi3mr/mpi3mr_os.c

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4012,20 +4012,45 @@ static inline void mpi3mr_setup_divert_ws(struct mpi3mr_ioc *mrioc,
40124012
* mpi3mr_eh_host_reset - Host reset error handling callback
40134013
* @scmd: SCSI command reference
40144014
*
4015-
* Issue controller reset if the scmd is for a Physical Device,
4016-
* if the scmd is for RAID volume, then wait for
4017-
* MPI3MR_RAID_ERRREC_RESET_TIMEOUT and checke whether any
4018-
* pending I/Os prior to issuing reset to the controller.
4015+
* Issue controller reset
40194016
*
40204017
* Return: SUCCESS of successful reset else FAILED
40214018
*/
40224019
static int mpi3mr_eh_host_reset(struct scsi_cmnd *scmd)
4020+
{
4021+
struct mpi3mr_ioc *mrioc = shost_priv(scmd->device->host);
4022+
int retval = FAILED, ret;
4023+
4024+
ret = mpi3mr_soft_reset_handler(mrioc,
4025+
MPI3MR_RESET_FROM_EH_HOS, 1);
4026+
if (ret)
4027+
goto out;
4028+
4029+
retval = SUCCESS;
4030+
out:
4031+
sdev_printk(KERN_INFO, scmd->device,
4032+
"Host reset is %s for scmd(%p)\n",
4033+
((retval == SUCCESS) ? "SUCCESS" : "FAILED"), scmd);
4034+
4035+
return retval;
4036+
}
4037+
4038+
/**
4039+
* mpi3mr_eh_bus_reset - Bus reset error handling callback
4040+
* @scmd: SCSI command reference
4041+
*
4042+
* Checks whether pending I/Os are present for the RAID volume;
4043+
* if not there's no need to reset the adapter.
4044+
*
4045+
* Return: SUCCESS of successful reset else FAILED
4046+
*/
4047+
static int mpi3mr_eh_bus_reset(struct scsi_cmnd *scmd)
40234048
{
40244049
struct mpi3mr_ioc *mrioc = shost_priv(scmd->device->host);
40254050
struct mpi3mr_stgt_priv_data *stgt_priv_data;
40264051
struct mpi3mr_sdev_priv_data *sdev_priv_data;
40274052
u8 dev_type = MPI3_DEVICE_DEVFORM_VD;
4028-
int retval = FAILED, ret;
4053+
int retval = FAILED;
40294054

40304055
sdev_priv_data = scmd->device->hostdata;
40314056
if (sdev_priv_data && sdev_priv_data->tgt_priv_data) {
@@ -4035,25 +4060,16 @@ static int mpi3mr_eh_host_reset(struct scsi_cmnd *scmd)
40354060

40364061
if (dev_type == MPI3_DEVICE_DEVFORM_VD) {
40374062
mpi3mr_wait_for_host_io(mrioc,
4038-
MPI3MR_RAID_ERRREC_RESET_TIMEOUT);
4039-
if (!mpi3mr_get_fw_pending_ios(mrioc)) {
4063+
MPI3MR_RAID_ERRREC_RESET_TIMEOUT);
4064+
if (!mpi3mr_get_fw_pending_ios(mrioc))
40404065
retval = SUCCESS;
4041-
goto out;
4042-
}
40434066
}
4067+
if (retval == FAILED)
4068+
mpi3mr_print_pending_host_io(mrioc);
40444069

4045-
mpi3mr_print_pending_host_io(mrioc);
4046-
ret = mpi3mr_soft_reset_handler(mrioc,
4047-
MPI3MR_RESET_FROM_EH_HOS, 1);
4048-
if (ret)
4049-
goto out;
4050-
4051-
retval = SUCCESS;
4052-
out:
40534070
sdev_printk(KERN_INFO, scmd->device,
4054-
"Host reset is %s for scmd(%p)\n",
4055-
((retval == SUCCESS) ? "SUCCESS" : "FAILED"), scmd);
4056-
4071+
"Bus reset is %s for scmd(%p)\n",
4072+
((retval == SUCCESS) ? "SUCCESS" : "FAILED"), scmd);
40574073
return retval;
40584074
}
40594075

@@ -4900,6 +4916,7 @@ static const struct scsi_host_template mpi3mr_driver_template = {
49004916
.change_queue_depth = mpi3mr_change_queue_depth,
49014917
.eh_device_reset_handler = mpi3mr_eh_dev_reset,
49024918
.eh_target_reset_handler = mpi3mr_eh_target_reset,
4919+
.eh_bus_reset_handler = mpi3mr_eh_bus_reset,
49034920
.eh_host_reset_handler = mpi3mr_eh_host_reset,
49044921
.bios_param = mpi3mr_bios_param,
49054922
.map_queues = mpi3mr_map_queues,

0 commit comments

Comments
 (0)