diff mbox series

[v3,10/14] scsi: target: iscsit: Add helper to check when cmd has failed

Message ID 20230129234441.116310-11-michael.christie@oracle.com (mailing list archive)
State New, archived
Headers show
Series target: TMF and recovery fixes | expand

Commit Message

Mike Christie Jan. 29, 2023, 11:44 p.m. UTC
This moves the check in lio_queue_status to new helper so other code can
use it to check for commands that were failed by lio core or iscsit.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
---
 drivers/target/iscsi/iscsi_target_configfs.c | 3 +--
 include/target/iscsi/iscsi_target_core.h     | 5 +++++
 2 files changed, 6 insertions(+), 2 deletions(-)

Comments

Maurizio Lombardi Feb. 27, 2023, 3:12 p.m. UTC | #1
po 30. 1. 2023 v 0:45 odesílatel Mike Christie
<michael.christie@oracle.com> napsal:
>
> This moves the check in lio_queue_status to new helper so other code can
> use it to check for commands that were failed by lio core or iscsit.
>
> Signed-off-by: Mike Christie <michael.christie@oracle.com>
> ---
>  drivers/target/iscsi/iscsi_target_configfs.c | 3 +--
>  include/target/iscsi/iscsi_target_core.h     | 5 +++++
>  2 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c
> index 5d0f51822414..82c1d335c369 100644
> --- a/drivers/target/iscsi/iscsi_target_configfs.c
> +++ b/drivers/target/iscsi/iscsi_target_configfs.c
> @@ -1411,9 +1411,8 @@ static int lio_queue_status(struct se_cmd *se_cmd)
>
>         cmd->i_state = ISTATE_SEND_STATUS;
>
> -       if (cmd->se_cmd.scsi_status || cmd->sense_reason) {
> +       if (iscsit_cmd_failed(cmd))
>                 return iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state);
> -       }
>         return conn->conn_transport->iscsit_queue_status(conn, cmd);
>  }
>
> diff --git a/include/target/iscsi/iscsi_target_core.h b/include/target/iscsi/iscsi_target_core.h
> index 229118156a1f..938dee8b7a51 100644
> --- a/include/target/iscsi/iscsi_target_core.h
> +++ b/include/target/iscsi/iscsi_target_core.h
> @@ -913,6 +913,11 @@ static inline u32 session_get_next_ttt(struct iscsit_session *session)
>         return ttt;
>  }
>
> +static inline bool iscsit_cmd_failed(struct iscsit_cmd *cmd)
> +{
> +       return cmd->se_cmd.scsi_status || cmd->sense_reason;
> +}
> +
>  extern struct iscsit_cmd *iscsit_find_cmd_from_itt(struct iscsit_conn *, itt_t);
>
>  extern void iscsit_thread_check_cpumask(struct iscsit_conn *conn,
> --
> 2.25.1
>

Reviewed-by: Maurizio Lombardi <mlombard@redhat.com>
diff mbox series

Patch

diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c
index 5d0f51822414..82c1d335c369 100644
--- a/drivers/target/iscsi/iscsi_target_configfs.c
+++ b/drivers/target/iscsi/iscsi_target_configfs.c
@@ -1411,9 +1411,8 @@  static int lio_queue_status(struct se_cmd *se_cmd)
 
 	cmd->i_state = ISTATE_SEND_STATUS;
 
-	if (cmd->se_cmd.scsi_status || cmd->sense_reason) {
+	if (iscsit_cmd_failed(cmd))
 		return iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state);
-	}
 	return conn->conn_transport->iscsit_queue_status(conn, cmd);
 }
 
diff --git a/include/target/iscsi/iscsi_target_core.h b/include/target/iscsi/iscsi_target_core.h
index 229118156a1f..938dee8b7a51 100644
--- a/include/target/iscsi/iscsi_target_core.h
+++ b/include/target/iscsi/iscsi_target_core.h
@@ -913,6 +913,11 @@  static inline u32 session_get_next_ttt(struct iscsit_session *session)
 	return ttt;
 }
 
+static inline bool iscsit_cmd_failed(struct iscsit_cmd *cmd)
+{
+	return cmd->se_cmd.scsi_status || cmd->sense_reason;
+}
+
 extern struct iscsit_cmd *iscsit_find_cmd_from_itt(struct iscsit_conn *, itt_t);
 
 extern void iscsit_thread_check_cpumask(struct iscsit_conn *conn,