/* Fail commands. session lock held and recv side suspended and xmit thread flushed  */
static void fail_scsi_tasks(struct iscsi_conn *conn, unsigned lun, int error)
/* Fail commands. session lock held and recv side suspended and xmit thread flushed  */
static void fail_scsi_tasks(struct iscsi_conn *conn, unsigned lun, int error)
{
	struct iscsi_task *task;
	int i;
	for (i = 0; i < conn->session->cmds_max; i++) {
		task = conn->session->cmds[i];
		if (!task->sc || task->state == ISCSI_TASK_FREE)
			continue;
		if (lun != -1 && lun != task->sc->device->lun)
			continue;
		ISCSI_DBG_SESSION(conn->session,
				  "failing sc %p itt 0x%x state %d\n",
				  task->sc, task->itt, task->state);
		fail_scsi_task(task, error);
	}
}