static void fail_scsi_tasks(struct iscsi_conn *conn, u64 lun, int error)
{
	struct iscsi_session *session = conn->session;
	struct iscsi_task *task;
	int i;

	spin_lock_bh(&session->back_lock);
	for (i = 0; i < session->cmds_max; i++) {
		task = session->cmds[i];
		if (!task->sc || task->state == ISCSI_TASK_FREE)
			continue;

		if (lun != -1 && lun != task->sc->device->lun)
			continue;

		__iscsi_get_task(task);
		spin_unlock_bh(&session->back_lock);

		ISCSI_DBG_SESSION(session,
				  "failing sc %p itt 0x%x state %d\n",
				  task->sc, task->itt, task->state);
		fail_scsi_task(task, error);

		spin_unlock_bh(&session->frwd_lock);
		iscsi_put_task(task);
		spin_lock_bh(&session->frwd_lock);

		spin_lock_bh(&session->back_lock);
	}

	spin_unlock_bh(&session->back_lock);
}
static void fail_scsi_tasks(struct iscsi_conn *conn, u64 lun, int error)
{
	struct iscsi_session *session = conn->session;
	struct iscsi_task *task;
	int i;

	spin_lock_bh(&session->back_lock);
	for (i = 0; i < session->cmds_max; i++) {
		task = session->cmds[i];
		if (!task->sc || task->state == ISCSI_TASK_FREE)
			continue;

		if (lun != -1 && lun != task->sc->device->lun)
			continue;

		__iscsi_get_task(task);
		spin_unlock_bh(&session->back_lock);

		ISCSI_DBG_SESSION(session,
				  "failing sc %p itt 0x%x state %d\n",
				  task->sc, task->itt, task->state);
		fail_scsi_task(task, error);

		spin_unlock_bh(&session->frwd_lock);
		iscsi_put_task(task);
		spin_lock_bh(&session->frwd_lock);

		spin_lock_bh(&session->back_lock);
	}

	spin_unlock_bh(&session->back_lock);
}