diff --git a/iscsi-scst/kernel/nthread.c b/iscsi-scst/kernel/nthread.c index 575674bf4..db09f65d3 100644 --- a/iscsi-scst/kernel/nthread.c +++ b/iscsi-scst/kernel/nthread.c @@ -1315,15 +1315,19 @@ static int write_data(struct iscsi_conn *conn) (unsigned long long)conn->session->sid, conn->cid, conn->write_cmnd); } - if (ref_cmd_to_parent && - ((ref_cmd->scst_cmd != NULL) || (ref_cmd->scst_aen != NULL))) { - if (ref_cmd->scst_state == ISCSI_CMD_STATE_AEN) - scst_set_aen_delivery_status(ref_cmd->scst_aen, - SCST_AEN_RES_FAILED); - else - scst_set_delivery_status(ref_cmd->scst_cmd, - SCST_CMD_DELIVERY_FAILED); + + if (ref_cmd_to_parent) { + if (ref_cmd->scst_state == ISCSI_CMD_STATE_AEN) { + if (ref_cmd->scst_aen) + scst_set_aen_delivery_status(ref_cmd->scst_aen, + SCST_AEN_RES_FAILED); + } else { + if (ref_cmd->scst_cmd) + scst_set_delivery_status(ref_cmd->scst_cmd, + SCST_CMD_DELIVERY_FAILED); + } } + goto out; }