Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cabe4569 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6:
  [SCSI] libiscsi: sync up iscsi and scsi eh's access to the connection
  [SCSI] libiscsi: fix null ptr regression when aborting a command with data to transfer
  [SCSI] qla2xxx: Update version number to 8.02.00-k3.
  [SCSI] qla2xxx: Correct mailbox register dump for FWI2 capable ISPs.
  [SCSI] qla2xxx: Correct 8GB iIDMA support.
  [SCSI] qla2xxx: Correct management-server login-state synchronization issue.
  [SCSI] qla2xxx: Don't modify parity bits during ISP25XX restart.
  [SCSI] qla2xxx: Allocate enough space for the full PCI descriptor.
  [SCSI] zfcp: fix the data buffer accessor patch
  [SCSI] zfcp: allocate gid_pn_data objects from gid_pn_cache
  [SCSI] zfcp: fix memory leak
parents 0d4cbb5e 6724add1
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -1503,7 +1503,7 @@ zfcp_gid_pn_buffers_alloc(struct zfcp_gid_pn_data **gid_pn, mempool_t *pool)
			data->ct.pool = pool;
			data->ct.pool = pool;
		}
		}
	} else {
	} else {
		data = kmalloc(sizeof(struct zfcp_gid_pn_data), GFP_ATOMIC);
		data = kmem_cache_alloc(zfcp_data.gid_pn_cache, GFP_ATOMIC);
	}
	}


        if (NULL == data)
        if (NULL == data)
@@ -1531,7 +1531,7 @@ static void zfcp_gid_pn_buffers_free(struct zfcp_gid_pn_data *gid_pn)
	if (gid_pn->ct.pool)
	if (gid_pn->ct.pool)
		mempool_free(gid_pn, gid_pn->ct.pool);
		mempool_free(gid_pn, gid_pn->ct.pool);
	else
	else
		kfree(gid_pn);
		kmem_cache_free(zfcp_data.gid_pn_cache, gid_pn);
}
}


/**
/**
+3 −7
Original line number Original line Diff line number Diff line
@@ -640,13 +640,9 @@ int
zfcp_qdio_sbals_from_scsicmnd(struct zfcp_fsf_req *fsf_req,
zfcp_qdio_sbals_from_scsicmnd(struct zfcp_fsf_req *fsf_req,
			      unsigned long sbtype, struct scsi_cmnd *scsi_cmnd)
			      unsigned long sbtype, struct scsi_cmnd *scsi_cmnd)
{
{
	if (scsi_sg_count(scsi_cmnd))
	return zfcp_qdio_sbals_from_sg(fsf_req,	sbtype, scsi_sglist(scsi_cmnd),
		return zfcp_qdio_sbals_from_sg(fsf_req,	sbtype,
					       scsi_sglist(scsi_cmnd),
				       scsi_sg_count(scsi_cmnd),
				       scsi_sg_count(scsi_cmnd),
				       ZFCP_MAX_SBALS_PER_REQ);
				       ZFCP_MAX_SBALS_PER_REQ);
	else
		return 0;
}
}


/**
/**
+3 −1
Original line number Original line Diff line number Diff line
@@ -764,7 +764,9 @@ zfcp_reset_fc_host_stats(struct Scsi_Host *shost)
		return;
		return;


	ret = zfcp_fsf_exchange_port_data(NULL, adapter, data);
	ret = zfcp_fsf_exchange_port_data(NULL, adapter, data);
	if (ret == 0) {
	if (ret) {
		kfree(data);
	} else {
		adapter->stats_reset = jiffies/HZ;
		adapter->stats_reset = jiffies/HZ;
		old_data = adapter->stats_reset_data;
		old_data = adapter->stats_reset_data;
		adapter->stats_reset_data = data; /* finally freed in
		adapter->stats_reset_data = data; /* finally freed in
+52 −13
Original line number Original line Diff line number Diff line
@@ -737,12 +737,19 @@ static int iscsi_data_xmit(struct iscsi_conn *conn)
		 */
		 */
		conn->ctask = list_entry(conn->xmitqueue.next,
		conn->ctask = list_entry(conn->xmitqueue.next,
					 struct iscsi_cmd_task, running);
					 struct iscsi_cmd_task, running);
		if (conn->ctask->state == ISCSI_TASK_PENDING) {
		switch (conn->ctask->state) {
		case ISCSI_TASK_ABORTING:
			break;
		case ISCSI_TASK_PENDING:
			iscsi_prep_scsi_cmd_pdu(conn->ctask);
			iscsi_prep_scsi_cmd_pdu(conn->ctask);
			conn->session->tt->init_cmd_task(conn->ctask);
			conn->session->tt->init_cmd_task(conn->ctask);
		}
			/* fall through */
		default:
			conn->ctask->state = ISCSI_TASK_RUNNING;
			conn->ctask->state = ISCSI_TASK_RUNNING;
			break;
		}
		list_move_tail(conn->xmitqueue.next, &conn->run_list);
		list_move_tail(conn->xmitqueue.next, &conn->run_list);

		rc = iscsi_xmit_ctask(conn);
		rc = iscsi_xmit_ctask(conn);
		if (rc)
		if (rc)
			goto again;
			goto again;
@@ -1049,7 +1056,9 @@ static int iscsi_exec_abort_task(struct scsi_cmnd *sc,
	ctask->mtask = __iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)hdr,
	ctask->mtask = __iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)hdr,
					    NULL, 0);
					    NULL, 0);
	if (!ctask->mtask) {
	if (!ctask->mtask) {
		spin_unlock_bh(&session->lock);
		iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED);
		iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED);
		spin_lock_bh(&session->lock)
		debug_scsi("abort sent failure [itt 0x%x]\n", ctask->itt);
		debug_scsi("abort sent failure [itt 0x%x]\n", ctask->itt);
		return -EPERM;
		return -EPERM;
	}
	}
@@ -1066,6 +1075,7 @@ static int iscsi_exec_abort_task(struct scsi_cmnd *sc,
		debug_scsi("abort set timeout [itt 0x%x]\n", ctask->itt);
		debug_scsi("abort set timeout [itt 0x%x]\n", ctask->itt);
	}
	}
	spin_unlock_bh(&session->lock);
	spin_unlock_bh(&session->lock);
	mutex_unlock(&session->eh_mutex);
	scsi_queue_work(session->host, &conn->xmitwork);
	scsi_queue_work(session->host, &conn->xmitwork);


	/*
	/*
@@ -1083,6 +1093,7 @@ static int iscsi_exec_abort_task(struct scsi_cmnd *sc,
	if (signal_pending(current))
	if (signal_pending(current))
		flush_signals(current);
		flush_signals(current);
	del_timer_sync(&conn->tmabort_timer);
	del_timer_sync(&conn->tmabort_timer);
	mutex_lock(&session->eh_mutex);
	spin_lock_bh(&session->lock);
	spin_lock_bh(&session->lock);
	return 0;
	return 0;
}
}
@@ -1158,31 +1169,45 @@ static void fail_command(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask,
	__iscsi_put_ctask(ctask);
	__iscsi_put_ctask(ctask);
}
}


static void iscsi_suspend_tx(struct iscsi_conn *conn)
{
	set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx);
	scsi_flush_work(conn->session->host);
}

static void iscsi_start_tx(struct iscsi_conn *conn)
{
	clear_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx);
	scsi_queue_work(conn->session->host, &conn->xmitwork);
}

int iscsi_eh_abort(struct scsi_cmnd *sc)
int iscsi_eh_abort(struct scsi_cmnd *sc)
{
{
	struct Scsi_Host *host = sc->device->host;
	struct iscsi_session *session = iscsi_hostdata(host->hostdata);
	struct iscsi_cmd_task *ctask;
	struct iscsi_cmd_task *ctask;
	struct iscsi_conn *conn;
	struct iscsi_conn *conn;
	struct iscsi_session *session;
	int rc;
	int rc;


	mutex_lock(&session->eh_mutex);
	spin_lock_bh(&session->lock);
	/*
	/*
	 * if session was ISCSI_STATE_IN_RECOVERY then we may not have
	 * if session was ISCSI_STATE_IN_RECOVERY then we may not have
	 * got the command.
	 * got the command.
	 */
	 */
	if (!sc->SCp.ptr) {
	if (!sc->SCp.ptr) {
		debug_scsi("sc never reached iscsi layer or it completed.\n");
		debug_scsi("sc never reached iscsi layer or it completed.\n");
		spin_unlock_bh(&session->lock);
		mutex_unlock(&session->eh_mutex);
		return SUCCESS;
		return SUCCESS;
	}
	}


	ctask = (struct iscsi_cmd_task *)sc->SCp.ptr;
	ctask = (struct iscsi_cmd_task *)sc->SCp.ptr;
	conn = ctask->conn;
	conn = ctask->conn;
	session = conn->session;


	conn->eh_abort_cnt++;
	conn->eh_abort_cnt++;
	debug_scsi("aborting [sc %p itt 0x%x]\n", sc, ctask->itt);
	debug_scsi("aborting [sc %p itt 0x%x]\n", sc, ctask->itt);


	spin_lock_bh(&session->lock);

	/*
	/*
	 * If we are not logged in or we have started a new session
	 * If we are not logged in or we have started a new session
	 * then let the host reset code handle this
	 * then let the host reset code handle this
@@ -1219,6 +1244,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc)
	switch (conn->tmabort_state) {
	switch (conn->tmabort_state) {
	case TMABORT_SUCCESS:
	case TMABORT_SUCCESS:
		spin_unlock_bh(&session->lock);
		spin_unlock_bh(&session->lock);
		iscsi_suspend_tx(conn);
		/*
		/*
		 * clean up task if aborted. grab the recv lock as a writer
		 * clean up task if aborted. grab the recv lock as a writer
		 */
		 */
@@ -1227,11 +1253,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc)
		fail_command(conn, ctask, DID_ABORT << 16);
		fail_command(conn, ctask, DID_ABORT << 16);
		spin_unlock(&session->lock);
		spin_unlock(&session->lock);
		write_unlock_bh(conn->recv_lock);
		write_unlock_bh(conn->recv_lock);
		/*
		iscsi_start_tx(conn);
		 * make sure xmit thread is not still touching the
		 * ctask/scsi_cmnd
		 */
		scsi_flush_work(session->host);
		goto success_unlocked;
		goto success_unlocked;
	case TMABORT_NOT_FOUND:
	case TMABORT_NOT_FOUND:
		if (!ctask->sc) {
		if (!ctask->sc) {
@@ -1251,12 +1273,14 @@ int iscsi_eh_abort(struct scsi_cmnd *sc)
	spin_unlock_bh(&session->lock);
	spin_unlock_bh(&session->lock);
success_unlocked:
success_unlocked:
	debug_scsi("abort success [sc %lx itt 0x%x]\n", (long)sc, ctask->itt);
	debug_scsi("abort success [sc %lx itt 0x%x]\n", (long)sc, ctask->itt);
	mutex_unlock(&session->eh_mutex);
	return SUCCESS;
	return SUCCESS;


failed:
failed:
	spin_unlock_bh(&session->lock);
	spin_unlock_bh(&session->lock);
failed_unlocked:
failed_unlocked:
	debug_scsi("abort failed [sc %lx itt 0x%x]\n", (long)sc, ctask->itt);
	debug_scsi("abort failed [sc %lx itt 0x%x]\n", (long)sc, ctask->itt);
	mutex_unlock(&session->eh_mutex);
	return FAILED;
	return FAILED;
}
}
EXPORT_SYMBOL_GPL(iscsi_eh_abort);
EXPORT_SYMBOL_GPL(iscsi_eh_abort);
@@ -1403,6 +1427,7 @@ iscsi_session_setup(struct iscsi_transport *iscsit,
	session->max_cmdsn = initial_cmdsn + 1;
	session->max_cmdsn = initial_cmdsn + 1;
	session->max_r2t = 1;
	session->max_r2t = 1;
	session->tt = iscsit;
	session->tt = iscsit;
	mutex_init(&session->eh_mutex);


	/* initialize SCSI PDU commands pool */
	/* initialize SCSI PDU commands pool */
	if (iscsi_pool_init(&session->cmdpool, session->cmds_max,
	if (iscsi_pool_init(&session->cmdpool, session->cmds_max,
@@ -1736,9 +1761,22 @@ static void iscsi_start_session_recovery(struct iscsi_session *session,
{
{
	int old_stop_stage;
	int old_stop_stage;


	mutex_lock(&session->eh_mutex);
	spin_lock_bh(&session->lock);
	spin_lock_bh(&session->lock);
	if (conn->stop_stage == STOP_CONN_TERM) {
	if (conn->stop_stage == STOP_CONN_TERM) {
		spin_unlock_bh(&session->lock);
		spin_unlock_bh(&session->lock);
		mutex_unlock(&session->eh_mutex);
		return;
	}

	/*
	 * The LLD either freed/unset the lock on us, or userspace called
	 * stop but did not create a proper connection (connection was never
	 * bound or it was unbound then stop was called).
	 */
	if (!conn->recv_lock) {
		spin_unlock_bh(&session->lock);
		mutex_unlock(&session->eh_mutex);
		return;
		return;
	}
	}


@@ -1755,9 +1793,9 @@ static void iscsi_start_session_recovery(struct iscsi_session *session,
	old_stop_stage = conn->stop_stage;
	old_stop_stage = conn->stop_stage;
	conn->stop_stage = flag;
	conn->stop_stage = flag;
	conn->c_stage = ISCSI_CONN_STOPPED;
	conn->c_stage = ISCSI_CONN_STOPPED;
	set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx);
	spin_unlock_bh(&session->lock);
	spin_unlock_bh(&session->lock);
	scsi_flush_work(session->host);

	iscsi_suspend_tx(conn);


	write_lock_bh(conn->recv_lock);
	write_lock_bh(conn->recv_lock);
	set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx);
	set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx);
@@ -1786,6 +1824,7 @@ static void iscsi_start_session_recovery(struct iscsi_session *session,
	fail_all_commands(conn);
	fail_all_commands(conn);
	flush_control_queues(session, conn);
	flush_control_queues(session, conn);
	spin_unlock_bh(&session->lock);
	spin_unlock_bh(&session->lock);
	mutex_unlock(&session->eh_mutex);
}
}


void iscsi_conn_stop(struct iscsi_cls_conn *cls_conn, int flag)
void iscsi_conn_stop(struct iscsi_cls_conn *cls_conn, int flag)
+9 −12
Original line number Original line Diff line number Diff line
@@ -2050,21 +2050,18 @@ qla25xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
void
void
qla2x00_dump_regs(scsi_qla_host_t *ha)
qla2x00_dump_regs(scsi_qla_host_t *ha)
{
{
	int i;
	struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
	struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
	struct device_reg_24xx __iomem *reg24 = &ha->iobase->isp24;
	uint16_t __iomem *mbx_reg;

	mbx_reg = IS_FWI2_CAPABLE(ha) ? &reg24->mailbox0:
	    MAILBOX_REG(ha, reg, 0);


	printk("Mailbox registers:\n");
	printk("Mailbox registers:\n");
	printk("scsi(%ld): mbox 0 0x%04x \n",
	for (i = 0; i < 6; i++)
	    ha->host_no, RD_MAILBOX_REG(ha, reg, 0));
		printk("scsi(%ld): mbox %d 0x%04x \n", ha->host_no, i,
	printk("scsi(%ld): mbox 1 0x%04x \n",
		    RD_REG_WORD(mbx_reg++));
	    ha->host_no, RD_MAILBOX_REG(ha, reg, 1));
	printk("scsi(%ld): mbox 2 0x%04x \n",
	    ha->host_no, RD_MAILBOX_REG(ha, reg, 2));
	printk("scsi(%ld): mbox 3 0x%04x \n",
	    ha->host_no, RD_MAILBOX_REG(ha, reg, 3));
	printk("scsi(%ld): mbox 4 0x%04x \n",
	    ha->host_no, RD_MAILBOX_REG(ha, reg, 4));
	printk("scsi(%ld): mbox 5 0x%04x \n",
	    ha->host_no, RD_MAILBOX_REG(ha, reg, 5));
}
}




Loading