static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task,
			   bool was_requeue)
{
	int rc;

	spin_lock_bh(&conn->session->back_lock);

	if (!conn->task) {
		/* Take a ref so we can access it after xmit_task() */
		__iscsi_get_task(task);
	} else {
		/* Already have a ref from when we failed to send it last call */
		conn->task = NULL;
	}

	/*
	 * If this was a requeue for a R2T we have an extra ref on the task in
	 * case a bad target sends a cmd rsp before we have handled the task.
	 */
	if (was_requeue)
		__iscsi_put_task(task);

	/*
	 * Do this after dropping the extra ref because if this was a requeue
	 * it's removed from that list and cleanup_queued_task would miss it.
	 */
	if (test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx)) {
		/*
		 * Save the task and ref in case we weren't cleaning up this
		 * task and get woken up again.
		 */
		conn->task = task;
		spin_unlock_bh(&conn->session->back_lock);
		return -ENODATA;
	}
	spin_unlock_bh(&conn->session->back_lock);

	spin_unlock_bh(&conn->session->frwd_lock);
	rc = conn->session->tt->xmit_task(task);
	spin_lock_bh(&conn->session->frwd_lock);
	if (!rc) {
		/* done with this task */
		task->last_xfer = jiffies;
	}
	/* regular RX path uses back_lock */
	spin_lock(&conn->session->back_lock);
	if (rc && task->state == ISCSI_TASK_RUNNING) {
		/*
		 * get an extra ref that is released next time we access it
		 * as conn->task above.
		 */
		__iscsi_get_task(task);
		conn->task = task;
	}

	__iscsi_put_task(task);
	spin_unlock(&conn->session->back_lock);
	return rc;
}
static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task,
			   bool was_requeue)
{
	int rc;

	spin_lock_bh(&conn->session->back_lock);

	if (!conn->task) {
		 
		__iscsi_get_task(task);
	} else {
		 
		conn->task = NULL;
	}

	 
	if (was_requeue)
		__iscsi_put_task(task);

	 
	if (test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx)) {
		 
		conn->task = task;
		spin_unlock_bh(&conn->session->back_lock);
		return -ENODATA;
	}
	spin_unlock_bh(&conn->session->back_lock);

	spin_unlock_bh(&conn->session->frwd_lock);
	rc = conn->session->tt->xmit_task(task);
	spin_lock_bh(&conn->session->frwd_lock);
	if (!rc) {
		 
		task->last_xfer = jiffies;
	}
	 
	spin_lock(&conn->session->back_lock);
	if (rc && task->state == ISCSI_TASK_RUNNING) {
		 
		__iscsi_get_task(task);
		conn->task = task;
	}

	__iscsi_put_task(task);
	spin_unlock(&conn->session->back_lock);
	return rc;
}