Commit 82141ddb authored by Kashyap Desai's avatar Kashyap Desai Committed by Martin K. Petersen

scsi: mpi3mr: Allow certain commands during pci-remove hook

Instead of driver returning DID_NO_CONNECT during driver unload allow SSU
and Sync Cache commands to be sent to the controller to flush any cached
data from the drive.

Link: https://lore.kernel.org/r/20210520152545.2710479-16-kashyap.desai@broadcom.com
Cc: sathya.prakash@broadcom.com
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Reviewed-by: default avatarTomas Henzl <thenzl@redhat.com>
Reviewed-by: default avatarHimanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: default avatarKashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 0ea17734
......@@ -2767,6 +2767,26 @@ static int mpi3mr_target_alloc(struct scsi_target *starget)
return retval;
}
/**
* mpi3mr_allow_scmd_to_fw - Command is allowed during shutdown
* @scmd: SCSI Command reference
*
* Checks whether a cdb is allowed during shutdown or not.
*
* Return: TRUE for allowed commands, FALSE otherwise.
*/
inline bool mpi3mr_allow_scmd_to_fw(struct scsi_cmnd *scmd)
{
switch (scmd->cmnd[0]) {
case SYNCHRONIZE_CACHE:
case START_STOP:
return true;
default:
return false;
}
}
/**
* mpi3mr_qcmd - I/O request despatcher
* @shost: SCSI Host reference
......@@ -2802,7 +2822,8 @@ static int mpi3mr_qcmd(struct Scsi_Host *shost,
goto out;
}
if (mrioc->stop_drv_processing) {
if (mrioc->stop_drv_processing &&
!(mpi3mr_allow_scmd_to_fw(scmd))) {
scmd->result = DID_NO_CONNECT << 16;
scmd->scsi_done(scmd);
goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment