diff --git a/iscsi-scst/kernel/iscsi.c b/iscsi-scst/kernel/iscsi.c index 3a2ded46a..d3aad9cd4 100644 --- a/iscsi-scst/kernel/iscsi.c +++ b/iscsi-scst/kernel/iscsi.c @@ -1646,12 +1646,16 @@ int cmnd_rx_continue(struct iscsi_cmnd *req) dir = scst_cmd_get_data_direction(scst_cmd); - /* Check prelim_compl_flags here to save R2Ts */ - if (unlikely(scst_cmd_completed(scst_cmd) || - unlikely(req->prelim_compl_flags != 0) || - unlikely(scst_cmd_aborted(scst_cmd)))) { - if (scst_cmd_aborted(scst_cmd)) - set_bit(ISCSI_CMD_ABORTED, &req->prelim_compl_flags); + /* + * Check for preliminary completion here to save R2Ts. For TASK QUEUE + * FULL statuses that might be a big performance win. + */ + if (unlikely(scst_cmd_prelim_completed(scst_cmd) || + unlikely(req->prelim_compl_flags != 0))) { + /* + * If necessary, ISCSI_CMD_ABORTED will be set by + * iscsi_xmit_response(). + */ res = iscsi_preliminary_complete(req, req, true); goto trace; } diff --git a/scst/include/scst.h b/scst/include/scst.h index 7ad9d0472..a68ee016b 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -2497,7 +2497,7 @@ static inline void scst_sess_set_tgt_priv(struct scst_session *sess, * safely ignore this warning since in_atomic() is used here only for debugging * purposes. */ -static inline int scst_cmd_atomic(struct scst_cmd *cmd) +static inline bool scst_cmd_atomic(struct scst_cmd *cmd) { int res = cmd->atomic; #ifdef CONFIG_SCST_EXTRACHECKS @@ -2513,11 +2513,12 @@ static inline int scst_cmd_atomic(struct scst_cmd *cmd) } /* - * Returns TRUE if cmd has been completed. + * Returns TRUE if cmd has been preliminary completed, i.e. completed or + * aborted. */ -static inline int scst_cmd_completed(struct scst_cmd *cmd) +static inline bool scst_cmd_prelim_completed(struct scst_cmd *cmd) { - return cmd->completed; + return cmd->completed || test_bit(SCST_CMD_ABORTED, &cmd->cmd_flags); } static inline enum scst_exec_context __scst_estimate_context(bool direct)