qla2xxx: Fixes for SCSI EH rework
Subsystems (2)
cover qla2xxx: Fixes for SCSI EH rework
Hi all,
with the SCSI EH rework the scsi_cmnd argument for the SCSI EH callbacks is going away, so we need to fixup the drivers to work without it.
This patchset modifies the qla2xxx driver to not rely on a specific command for the SCSI EH callbacks.
As usual, comments and reviews are welcome.
Hannes Reinecke (3):
qla2xxx: Do not call fc_block_scsi_eh() during bus reset
qla2xxx: Open-code qla2xxx_eh_target_reset()
qla2xxx: Open-code qla2xxx_eh_device_reset()
drivers/scsi/qla2xxx/qla_os.c | 116 ++++++++++++++++++++++------------ 1 file changed, 74 insertions(+), 42 deletions(-)
Signature · 1 line
2.29.2
PATCH 1/3 qla2xxx: Do not call fc_block_scsi_eh() during bus reset
When calling bus reset the driver will be doing a full SAN resync anyway, so there is no need to wait for any pending RSCNs; they'll be re-issued during resync anyway.
--- drivers/scsi/qla2xxx/qla_os.c | 10 ---------- 1 file changed, 10 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +0 -10
@@ -1499,7 +1499,6 @@ static int qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd) {scsi_qla_host_t *vha =shost_priv (cmd->device->host); -fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;int ret =FAILED ;unsigned int id;uint64_t lun;
@@ -1515,15 +1514,6 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd) id = cmd->device->id; lun = cmd->device->lun; -if (!fcport) { -return ret; - } - - ret =fc_block_scsi_eh (cmd); -if (ret !=0 ) -return ret; - ret =FAILED ; -if (qla2x00_chip_is_down (vha))return ret;
Signature · 1 line
2.29.2
RE: [EXT] [PATCH 1/3] qla2xxx: Do not call fc_block_scsi_eh() during bus reset
Hannes,
Quoted 53 lines
-----Original Message-----
From: Hannes Reinecke <[email protected]>
Sent: Thursday, August 19, 2021 2:49 PM
To: Martin K. Petersen <[email protected]>
Cc: Christoph Hellwig <[email protected]>; James Bottomley <[email protected]>; Nilesh Javali <[email protected]>; [email protected]; Hannes Reinecke <[email protected]>
Subject: [EXT] [PATCH 1/3] qla2xxx: Do not callfc_block_scsi_eh()during bus resetExternal Email
----------------------------------------------------------------------
When calling bus reset the driver will be doing a full SAN resync anyway, so there is no need to wait for any pending RSCNs; they'll be re-issued during resync anyway.Signed-off-by Hannes Reinecke <[email protected]>Cc Nilesh Javali <[email protected]>--- drivers/scsi/qla2xxx/qla_os.c | 10 ---------- 1 file changed, 10 deletions(-)drivers/scsi/qla2xxx/qla_os.c +0
-11@@ -1499,7 +1499,6 @@ static int qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd) {scsi_qla_host_t *vha =shost_priv (cmd->device->host); -fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;int ret =FAILED ;unsigned int id;uint64_t lun;@@ -1515,15 +1514,6 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd) id = cmd->device->id; lun = cmd->device->lun; -if (!fcport) { -return ret; - } - - ret =fc_block_scsi_eh (cmd); -if (ret !=0 ) -return ret; - ret =FAILED ; -if (qla2x00_chip_is_down (vha))return ret; --
Quoted 1 line
2.29.2
Thanks for the patches.
Martin K. Petersen
AppliedRe: [PATCH 1/3] qla2xxx: Do not call fc_block_scsi_eh() during bus reset
In reply to Hannes ReineckeHannes,
Quoted 3 lines
When calling bus reset the driver will be doing a full SAN resync anyway, so there is no need to wait for any pending RSCNs; they'll be re-issued during resync anyway.
Applied to 5.15/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
PATCH 2/3 qla2xxx: Open-code qla2xxx_eh_target_reset()
In reply to Hannes ReineckeDevice reset and target reset will be using different calling sequences, so open-code __qla2xxx_eh_generic_reset() in qla2xxx_eh_target_reset(). No functional changes.
--- drivers/scsi/qla2xxx/qla_os.c | 56 +++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 3 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +53 -3
@@ -1466,8 +1466,12 @@ qla2xxx_eh_device_reset(struct scsi_cmnd *cmd)static int qla2xxx_eh_target_reset (struct scsi_cmnd *cmd) { -scsi_qla_host_t *vha =shost_priv (cmd->device->host); +struct scsi_device *sdev = cmd->device; +struct fc_rport *rport =starget_to_rport (scsi_target (sdev)); +scsi_qla_host_t *vha =shost_priv (rport_to_shost (rport));struct qla_hw_data *ha = vha->hw; +fc_port_t *fcport = *(fc_port_t **)rport->dd_data; +int err;if (qla2x00_isp_reg_stat (ha)) { ql_log(ql_log_info, vha, 0x803f,
@@ -1476,8 +1480,54 @@ qla2xxx_eh_target_reset(struct scsi_cmnd *cmd)return FAILED ; } -return __qla2xxx_eh_generic_reset ("TARGET" ,WAIT_TARGET , cmd, - ha->isp_ops->target_reset); +if (!fcport) { +return FAILED ; + } + + err =fc_block_rport (rport); +if (err !=0 ) +return err; + +if (fcport->deleted) +return SUCCESS ; + +ql_log (ql_log_info, vha,0x8009 , +"TARGET RESET ISSUED nexus=%ld:%d cmd=%p.\n" , vha->host_no, + sdev->id, cmd); + + err =0 ; +if (qla2x00_wait_for_hba_online (vha) !=QLA_SUCCESS ) { +ql_log (ql_log_warn, vha,0x800a , +"Wait for hba online failed for cmd=%p.\n" , cmd); + goto eh_reset_failed; + } + err =2 ; +if (ha->isp_ops->target_reset (fcport,0 ,0 ) !=QLA_SUCCESS ) { +ql_log (ql_log_warn, vha,0x800c , +"target_reset failed for cmd=%p.\n" , cmd); + goto eh_reset_failed; + } + err =3 ; +if (qla2x00_eh_wait_for_pending_commands (vha, sdev->id, +0 ,WAIT_TARGET ) !=QLA_SUCCESS ) { +ql_log (ql_log_warn, vha,0x800d , +"wait for pending cmds failed for cmd=%p.\n" , cmd); + goto eh_reset_failed; + } + +ql_log (ql_log_info, vha,0x800e , +"TARGET RESET SUCCEEDED nexus:%ld:%d cmd=%p.\n" , + vha->host_no, sdev->id, cmd); + +return SUCCESS ; + +eh_reset_failed: +ql_log (ql_log_info, vha,0x800f , +"TARGET RESET FAILED: %s nexus=%ld:%d:%llu cmd=%p.\n" , + reset_errors[err], vha->host_no, cmd->device->id, cmd->device->lun, + cmd); + vha->reset_cmd_err_cnt++; +return FAILED ; }/**************************************************************************
Signature · 1 line
2.29.2
RE: [EXT] [PATCH 2/3] qla2xxx: Open-code qla2xxx_eh_target_reset()
Quoted 101 lines
-----Original Message-----
From: Hannes Reinecke <[email protected]>
Sent: Thursday, August 19, 2021 2:49 PM
To: Martin K. Petersen <[email protected]>
Cc: Christoph Hellwig <[email protected]>; James Bottomley <[email protected]>; Nilesh Javali <[email protected]>; [email protected]; Hannes Reinecke <[email protected]>
Subject: [EXT] [PATCH 2/3] qla2xxx: Open-codeqla2xxx_eh_target_reset()External Email
----------------------------------------------------------------------
Device reset and target reset will be using different calling sequences, so open-code__qla2xxx_eh_generic_reset()inqla2xxx_eh_target_reset(). No functional changes.Signed-off-by Hannes Reinecke <[email protected]>Cc Nilesh Javali <[email protected]>--- drivers/scsi/qla2xxx/qla_os.c | 56 +++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 3 deletions(-)drivers/scsi/qla2xxx/qla_os.c +53
-3@@ -1466,8 +1466,12 @@ qla2xxx_eh_device_reset(struct scsi_cmnd *cmd)static int qla2xxx_eh_target_reset (struct scsi_cmnd *cmd) { -scsi_qla_host_t *vha =shost_priv (cmd->device->host); +struct scsi_device *sdev = cmd->device; +struct fc_rport *rport =starget_to_rport (scsi_target (sdev)); +scsi_qla_host_t *vha =shost_priv (rport_to_shost (rport));struct qla_hw_data *ha = vha->hw; +fc_port_t *fcport = *(fc_port_t **)rport->dd_data; +int err;if (qla2x00_isp_reg_stat (ha)) { ql_log(ql_log_info, vha, 0x803f,@@ -1476,8 +1480,54 @@ qla2xxx_eh_target_reset(struct scsi_cmnd *cmd)return FAILED ; } -return __qla2xxx_eh_generic_reset ("TARGET" ,WAIT_TARGET , cmd, - ha->isp_ops->target_reset); +if (!fcport) { +return FAILED ; + } + + err =fc_block_rport (rport); +if (err !=0 ) +return err; + +if (fcport->deleted) +return SUCCESS ; + +ql_log (ql_log_info, vha,0x8009 , +"TARGET RESET ISSUED nexus=%ld:%d cmd=%p.\n" , vha->host_no, + sdev->id, cmd); + + err =0 ; +if (qla2x00_wait_for_hba_online (vha) !=QLA_SUCCESS ) { +ql_log (ql_log_warn, vha,0x800a , +"Wait for hba online failed for cmd=%p.\n" , cmd); + goto eh_reset_failed; + } + err =2 ; +if (ha->isp_ops->target_reset (fcport,0 ,0 ) !=QLA_SUCCESS ) { +ql_log (ql_log_warn, vha,0x800c , +"target_reset failed for cmd=%p.\n" , cmd); + goto eh_reset_failed; + } + err =3 ; +if (qla2x00_eh_wait_for_pending_commands (vha, sdev->id, +0 ,WAIT_TARGET ) !=QLA_SUCCESS ) { +ql_log (ql_log_warn, vha,0x800d , +"wait for pending cmds failed for cmd=%p.\n" , cmd); + goto eh_reset_failed; + } + +ql_log (ql_log_info, vha,0x800e , +"TARGET RESET SUCCEEDED nexus:%ld:%d cmd=%p.\n" , + vha->host_no, sdev->id, cmd); + +return SUCCESS ; + +eh_reset_failed: +ql_log (ql_log_info, vha,0x800f , +"TARGET RESET FAILED: %s nexus=%ld:%d:%llu cmd=%p.\n" , + reset_errors[err], vha->host_no, cmd->device->id, cmd->device- >lun, + cmd); + vha->reset_cmd_err_cnt++; +return FAILED ; }
Quoted 4 lines
/***************************************************************
***********
--
2.29.2
PATCH 3/3 qla2xxx: Open-code qla2xxx_eh_device_reset()
In reply to Hannes ReineckeDevice reset and target reset will be using different calling sequences, so open-code __qla2xxx_eh_generic_reset() in qla2xxx_eh_device_reset(), and remove the now obsolete function __qla2xxx_eh_generic_reset(). No functional changes.
--- drivers/scsi/qla2xxx/qla_os.c | 54 +++++++++++++++-------------------- 1 file changed, 23 insertions(+), 31 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +23 -31
@@ -1388,18 +1388,27 @@ static char *reset_errors[] = { };static int -__qla2xxx_eh_generic_reset (char *name,enum nexus_wait_type type, -struct scsi_cmnd *cmd,int (*do_reset)(struct fc_port *,uint64_t ,int )) +qla2xxx_eh_device_reset (struct scsi_cmnd *cmd) { -scsi_qla_host_t *vha =shost_priv (cmd->device->host); -fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; +struct scsi_device *sdev = cmd->device; +scsi_qla_host_t *vha =shost_priv (sdev->host); +struct fc_rport *rport =starget_to_rport (scsi_target (sdev)); +fc_port_t *fcport = (struct fc_port *) sdev->hostdata; +struct qla_hw_data *ha = vha->hw;int err; +if (qla2x00_isp_reg_stat (ha)) { +ql_log (ql_log_info, vha,0x803e , +"PCI/Register disconnect, exiting.\n" ); +qla_pci_set_eeh_busy (vha); +return FAILED ; + } +if (!fcport) {return FAILED ; } - err =fc_block_scsi_eh (cmd); + err =fc_block_rport (rport);if (err !=0 )return err;
@@ -1407,8 +1416,8 @@ __qla2xxx_eh_generic_reset(char *name, enum nexus_wait_type type,return SUCCESS ;ql_log (ql_log_info, vha,0x8009 , -"%s RESET ISSUED nexus=%ld:%d:%llu cmd=%p.\n" , name, vha->host_no, - cmd->device->id, cmd->device->lun, cmd); +"DEVICE RESET ISSUED nexus=%ld:%d:%llu cmd=%p.\n" , vha->host_no, + sdev->id, sdev->lun, cmd); err =0 ;if (qla2x00_wait_for_hba_online (vha) !=QLA_SUCCESS ) {
@@ -1417,52 +1426,35 @@ __qla2xxx_eh_generic_reset(char *name, enum nexus_wait_type type, goto eh_reset_failed; } err =2 ; -if (do_reset (fcport, cmd->device->lun,1 ) +if (ha->isp_ops->lun_reset (fcport, sdev->lun,1 ) !=QLA_SUCCESS ) {ql_log (ql_log_warn, vha,0x800c ,"do_reset failed for cmd=%p.\n" , cmd); goto eh_reset_failed; } err =3 ; -if (qla2x00_eh_wait_for_pending_commands (vha, cmd->device->id, - cmd->device->lun, type) !=QLA_SUCCESS ) { +if (qla2x00_eh_wait_for_pending_commands (vha, sdev->id, + sdev->lun,WAIT_LUN ) !=QLA_SUCCESS ) {ql_log (ql_log_warn, vha,0x800d ,"wait for pending cmds failed for cmd=%p.\n" , cmd); goto eh_reset_failed; }ql_log (ql_log_info, vha,0x800e , -"%s RESET SUCCEEDED nexus:%ld:%d:%llu cmd=%p.\n" , name, - vha->host_no, cmd->device->id, cmd->device->lun, cmd); +"DEVICE RESET SUCCEEDED nexus:%ld:%d:%llu cmd=%p.\n" , + vha->host_no, sdev->id, sdev->lun, cmd);return SUCCESS ; eh_reset_failed:ql_log (ql_log_info, vha,0x800f , -"%s RESET FAILED: %s nexus=%ld:%d:%llu cmd=%p.\n" , name, - reset_errors[err], vha->host_no, cmd->device->id, cmd->device->lun, +"DEVICE RESET FAILED: %s nexus=%ld:%d:%llu cmd=%p.\n" , + reset_errors[err], vha->host_no, sdev->id, sdev->lun, cmd); vha->reset_cmd_err_cnt++;return FAILED ; } -static int -qla2xxx_eh_device_reset (struct scsi_cmnd *cmd) -{ -scsi_qla_host_t *vha =shost_priv (cmd->device->host); -struct qla_hw_data *ha = vha->hw; - -if (qla2x00_isp_reg_stat (ha)) { -ql_log (ql_log_info, vha,0x803e , -"PCI/Register disconnect, exiting.\n" ); -qla_pci_set_eeh_busy (vha); -return FAILED ; - } - -return __qla2xxx_eh_generic_reset ("DEVICE" ,WAIT_LUN , cmd, - ha->isp_ops->lun_reset); -} -static int qla2xxx_eh_target_reset (struct scsi_cmnd *cmd) {
Signature · 1 line
2.29.2
RE: [EXT] [PATCH 3/3] qla2xxx: Open-code qla2xxx_eh_device_reset()
Quoted 137 lines
-----Original Message-----
From: Hannes Reinecke <[email protected]>
Sent: Thursday, August 19, 2021 2:49 PM
To: Martin K. Petersen <[email protected]>
Cc: Christoph Hellwig <[email protected]>; James Bottomley <[email protected]>; Nilesh Javali <[email protected]>; [email protected]; Hannes Reinecke <[email protected]>
Subject: [EXT] [PATCH 3/3] qla2xxx: Open-codeqla2xxx_eh_device_reset()External Email
----------------------------------------------------------------------
Device reset and target reset will be using different calling sequences, so open-code__qla2xxx_eh_generic_reset()inqla2xxx_eh_device_reset(), and remove the now obsolete function__qla2xxx_eh_generic_reset(). No functional changes.Signed-off-by Hannes Reinecke <[email protected]>Cc Nilesh Javali <[email protected]>--- drivers/scsi/qla2xxx/qla_os.c | 54 +++++++++++++++-------------------- 1 file changed, 23 insertions(+), 31 deletions(-)drivers/scsi/qla2xxx/qla_os.c +16
-7@@ -1388,18 +1388,27 @@ static char *reset_errors[] = { };static int -__qla2xxx_eh_generic_reset (char *name,enum nexus_wait_type type, -struct scsi_cmnd *cmd,int (*do_reset)(struct fc_port *,uint64_t ,int )) +qla2xxx_eh_device_reset (struct scsi_cmnd *cmd) { -scsi_qla_host_t *vha =shost_priv (cmd->device->host); -fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; +struct scsi_device *sdev = cmd->device; +scsi_qla_host_t *vha =shost_priv (sdev->host); +struct fc_rport *rport =starget_to_rport (scsi_target (sdev)); +fc_port_t *fcport = (struct fc_port *) sdev->hostdata; +struct qla_hw_data *ha = vha->hw;int err; +if (qla2x00_isp_reg_stat (ha)) { +ql_log (ql_log_info, vha,0x803e , +"PCI/Register disconnect, exiting.\n" ); +qla_pci_set_eeh_busy (vha); +return FAILED ; + } +if (!fcport) {return FAILED ; } - err =fc_block_scsi_eh (cmd); + err =fc_block_rport (rport);if (err !=0 )return err;@@ -1407,8 +1416,8 @@ __qla2xxx_eh_generic_reset(char *name, enumnexus_wait_type type, return SUCCESS;ql_log (ql_log_info, vha,0x8009 , -"%s RESET ISSUED nexus=%ld:%d:%llu cmd=%p.\n" , name, vha- >host_no, - cmd->device->id, cmd->device->lun, cmd); +"DEVICE RESET ISSUED nexus=%ld:%d:%llu cmd=%p.\n" , vha- >host_no, + sdev->id, sdev->lun, cmd);drivers/scsi/qla2xxx/qla_os.c +7
-24err =0 ;if (qla2x00_wait_for_hba_online (vha) !=QLA_SUCCESS ) {@@ -1417,52 +1426,35 @@ __qla2xxx_eh_generic_reset(char *name, enumnexus_wait_type type, goto eh_reset_failed; } err =2 ; -if (do_reset (fcport, cmd->device->lun,1 ) +if (ha->isp_ops->lun_reset (fcport, sdev->lun,1 ) !=QLA_SUCCESS ) {ql_log (ql_log_warn, vha,0x800c ,"do_reset failed for cmd=%p.\n" , cmd); goto eh_reset_failed; } err =3 ; -if (qla2x00_eh_wait_for_pending_commands (vha, cmd->device->id, - cmd->device->lun, type) !=QLA_SUCCESS ) { +if (qla2x00_eh_wait_for_pending_commands (vha, sdev->id, + sdev->lun,WAIT_LUN ) !=QLA_SUCCESS ) {ql_log (ql_log_warn, vha,0x800d ,"wait for pending cmds failed for cmd=%p.\n" , cmd); goto eh_reset_failed; }ql_log (ql_log_info, vha,0x800e , -"%s RESET SUCCEEDED nexus:%ld:%d:%llu cmd=%p.\n" , name, - vha->host_no, cmd->device->id, cmd->device->lun, cmd); +"DEVICE RESET SUCCEEDED nexus:%ld:%d:%llu cmd=%p.\n" , + vha->host_no, sdev->id, sdev->lun, cmd);return SUCCESS ; eh_reset_failed:ql_log (ql_log_info, vha,0x800f , -"%s RESET FAILED: %s nexus=%ld:%d:%llu cmd=%p.\n" , name, - reset_errors[err], vha->host_no, cmd->device->id, cmd->device- >lun, +"DEVICE RESET FAILED: %s nexus=%ld:%d:%llu cmd=%p.\n" , + reset_errors[err], vha->host_no, sdev->id, sdev->lun, cmd); vha->reset_cmd_err_cnt++;return FAILED ; } -static int -qla2xxx_eh_device_reset (struct scsi_cmnd *cmd) -{ -scsi_qla_host_t *vha =shost_priv (cmd->device->host); -struct qla_hw_data *ha = vha->hw; - -if (qla2x00_isp_reg_stat (ha)) { -ql_log (ql_log_info, vha,0x803e , -"PCI/Register disconnect, exiting.\n" ); -qla_pci_set_eeh_busy (vha); -return FAILED ; - } - -return __qla2xxx_eh_generic_reset ("DEVICE" ,WAIT_LUN , cmd, - ha->isp_ops->lun_reset); -} - static int
Quoted 4 lines
qla2xxx_eh_target_reset(struct scsi_cmnd *cmd)
{
--
2.29.2
Martin K. Petersen
AppliedQuoted 8 lines · Hannes Reinecke
with the SCSI EH rework the
scsi_cmndargument for the SCSI EH callbacks is going away, so we need to fixup the drivers to work without it.This patchset modifies the qla2xxx driver to not rely on a specific command for the SCSI EH callbacks.
[...]
Applied to 5.15/scsi-queue, thanks!
[1/3] qla2xxx: Do not call fc_block_scsi_eh() during bus reset
https://git.kernel.org/mkp/scsi/c/c74ce061f898 [2/3] qla2xxx: Open-code qla2xxx_eh_target_reset() https://git.kernel.org/mkp/scsi/c/e56b2234ab64 [3/3] qla2xxx: Open-code qla2xxx_eh_device_reset() https://git.kernel.org/mkp/scsi/c/cbe1f0d70072
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering