static void fail_scsi_task(struct iscsi_task *task, int err)
{
	struct iscsi_conn *conn = task->conn;
	struct scsi_cmnd *sc;
	int state;

	spin_lock_bh(&conn->session->back_lock);
	if (cleanup_queued_task(task)) {
		spin_unlock_bh(&conn->session->back_lock);
		return;
	}

	if (task->state == ISCSI_TASK_PENDING) {
		/*
		 * cmd never made it to the xmit thread, so we should not count
		 * the cmd in the sequencing
		 */
		conn->session->queued_cmdsn--;
		/* it was never sent so just complete like normal */
		state = ISCSI_TASK_COMPLETED;
	} else if (err == DID_TRANSPORT_DISRUPTED)
		state = ISCSI_TASK_ABRT_SESS_RECOV;
	else
		state = ISCSI_TASK_ABRT_TMF;

	sc = task->sc;
	sc->result = err << 16;
	scsi_set_resid(sc, scsi_bufflen(sc));
	iscsi_complete_task(task, state);
	spin_unlock_bh(&conn->session->back_lock);
}
static void fail_scsi_task(struct iscsi_task *task, int err)
{
	struct iscsi_conn *conn = task->conn;
	struct scsi_cmnd *sc;
	int state;

	spin_lock_bh(&conn->session->back_lock);
	if (cleanup_queued_task(task)) {
		spin_unlock_bh(&conn->session->back_lock);
		return;
	}

	if (task->state == ISCSI_TASK_PENDING) {
		 
		conn->session->queued_cmdsn--;
		 
		state = ISCSI_TASK_COMPLETED;
	} else if (err == DID_TRANSPORT_DISRUPTED)
		state = ISCSI_TASK_ABRT_SESS_RECOV;
	else
		state = ISCSI_TASK_ABRT_TMF;

	sc = task->sc;
	sc->result = err << 16;
	scsi_set_resid(sc, scsi_bufflen(sc));
	iscsi_complete_task(task, state);
	spin_unlock_bh(&conn->session->back_lock);
}