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

Commit 0b18ac42 authored by James Smart's avatar James Smart Committed by James Bottomley
Browse files

[SCSI] lpfc 8.1.6 : Fix Data Corruption in Bus Reset Path



This patch updates the lpfc driver to revision 8.1.6, which includes
the following changes:

 - Fix data corruption in SCSI BUS reset path, due to reusing
   the same request structure for each target.
 - Change version number to 8.1.6

Signed-off-by: default avatarJames Smart <James.Smart@emulex.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 6e1cad02
Loading
Loading
Loading
Loading
+19 −49
Original line number Original line Diff line number Diff line
@@ -629,8 +629,7 @@ lpfc_scsi_prep_task_mgmt_cmd(struct lpfc_hba *phba,
	struct lpfc_iocbq *piocbq;
	struct lpfc_iocbq *piocbq;
	IOCB_t *piocb;
	IOCB_t *piocb;
	struct fcp_cmnd *fcp_cmnd;
	struct fcp_cmnd *fcp_cmnd;
	struct scsi_device *scsi_dev = lpfc_cmd->pCmd->device;
	struct lpfc_rport_data *rdata = lpfc_cmd->rdata;
	struct lpfc_rport_data *rdata = scsi_dev->hostdata;
	struct lpfc_nodelist *ndlp = rdata->pnode;
	struct lpfc_nodelist *ndlp = rdata->pnode;


	if ((ndlp == NULL) || (ndlp->nlp_state != NLP_STE_MAPPED_NODE)) {
	if ((ndlp == NULL) || (ndlp->nlp_state != NLP_STE_MAPPED_NODE)) {
@@ -665,56 +664,18 @@ lpfc_scsi_prep_task_mgmt_cmd(struct lpfc_hba *phba,
		piocb->ulpTimeout = lpfc_cmd->timeout;
		piocb->ulpTimeout = lpfc_cmd->timeout;
	}
	}


	lpfc_cmd->rdata = rdata;

	switch (task_mgmt_cmd) {
	case FCP_LUN_RESET:
		/* Issue LUN Reset to TGT <num> LUN <num> */
		lpfc_printf_log(phba,
				KERN_INFO,
				LOG_FCP,
				"%d:0703 Issue LUN Reset to TGT %d LUN %d "
				"Data: x%x x%x\n",
				phba->brd_no,
				scsi_dev->id, scsi_dev->lun,
				ndlp->nlp_rpi, ndlp->nlp_flag);

		break;
	case FCP_ABORT_TASK_SET:
		/* Issue Abort Task Set to TGT <num> LUN <num> */
		lpfc_printf_log(phba,
				KERN_INFO,
				LOG_FCP,
				"%d:0701 Issue Abort Task Set to TGT %d LUN %d "
				"Data: x%x x%x\n",
				phba->brd_no,
				scsi_dev->id, scsi_dev->lun,
				ndlp->nlp_rpi, ndlp->nlp_flag);

		break;
	case FCP_TARGET_RESET:
		/* Issue Target Reset to TGT <num> */
		lpfc_printf_log(phba,
				KERN_INFO,
				LOG_FCP,
				"%d:0702 Issue Target Reset to TGT %d "
				"Data: x%x x%x\n",
				phba->brd_no,
				scsi_dev->id, ndlp->nlp_rpi,
				ndlp->nlp_flag);
		break;
	}

	return (1);
	return (1);
}
}


static int
static int
lpfc_scsi_tgt_reset(struct lpfc_scsi_buf * lpfc_cmd, struct lpfc_hba * phba)
lpfc_scsi_tgt_reset(struct lpfc_scsi_buf * lpfc_cmd, struct lpfc_hba * phba,
		    unsigned  tgt_id, struct lpfc_rport_data *rdata)
{
{
	struct lpfc_iocbq *iocbq;
	struct lpfc_iocbq *iocbq;
	struct lpfc_iocbq *iocbqrsp;
	struct lpfc_iocbq *iocbqrsp;
	int ret;
	int ret;


	lpfc_cmd->rdata = rdata;
	ret = lpfc_scsi_prep_task_mgmt_cmd(phba, lpfc_cmd, FCP_TARGET_RESET);
	ret = lpfc_scsi_prep_task_mgmt_cmd(phba, lpfc_cmd, FCP_TARGET_RESET);
	if (!ret)
	if (!ret)
		return FAILED;
		return FAILED;
@@ -726,6 +687,13 @@ lpfc_scsi_tgt_reset(struct lpfc_scsi_buf * lpfc_cmd, struct lpfc_hba * phba)
	if (!iocbqrsp)
	if (!iocbqrsp)
		return FAILED;
		return FAILED;


	/* Issue Target Reset to TGT <num> */
	lpfc_printf_log(phba, KERN_INFO, LOG_FCP,
			"%d:0702 Issue Target Reset to TGT %d "
			"Data: x%x x%x\n",
			phba->brd_no, tgt_id, rdata->pnode->nlp_rpi,
			rdata->pnode->nlp_flag);

	ret = lpfc_sli_issue_iocb_wait(phba,
	ret = lpfc_sli_issue_iocb_wait(phba,
				       &phba->sli.ring[phba->sli.fcp_ring],
				       &phba->sli.ring[phba->sli.fcp_ring],
				       iocbq, iocbqrsp, lpfc_cmd->timeout);
				       iocbq, iocbqrsp, lpfc_cmd->timeout);
@@ -1021,6 +989,7 @@ lpfc_reset_lun_handler(struct scsi_cmnd *cmnd)
	lpfc_cmd->pCmd = cmnd;
	lpfc_cmd->pCmd = cmnd;
	lpfc_cmd->timeout = 60;
	lpfc_cmd->timeout = 60;
	lpfc_cmd->scsi_hba = phba;
	lpfc_cmd->scsi_hba = phba;
	lpfc_cmd->rdata = rdata;


	ret = lpfc_scsi_prep_task_mgmt_cmd(phba, lpfc_cmd, FCP_LUN_RESET);
	ret = lpfc_scsi_prep_task_mgmt_cmd(phba, lpfc_cmd, FCP_LUN_RESET);
	if (!ret)
	if (!ret)
@@ -1033,6 +1002,11 @@ lpfc_reset_lun_handler(struct scsi_cmnd *cmnd)
	if (iocbqrsp == NULL)
	if (iocbqrsp == NULL)
		goto out_free_scsi_buf;
		goto out_free_scsi_buf;


	lpfc_printf_log(phba, KERN_INFO, LOG_FCP,
			"%d:0703 Issue LUN Reset to TGT %d LUN %d "
			"Data: x%x x%x\n", phba->brd_no, cmnd->device->id,
			cmnd->device->lun, pnode->nlp_rpi, pnode->nlp_flag);

	ret = lpfc_sli_issue_iocb_wait(phba,
	ret = lpfc_sli_issue_iocb_wait(phba,
				       &phba->sli.ring[phba->sli.fcp_ring],
				       &phba->sli.ring[phba->sli.fcp_ring],
				       iocbq, iocbqrsp, lpfc_cmd->timeout);
				       iocbq, iocbqrsp, lpfc_cmd->timeout);
@@ -1104,7 +1078,6 @@ lpfc_reset_bus_handler(struct scsi_cmnd *cmnd)
	int match;
	int match;
	int ret = FAILED, i, err_count = 0;
	int ret = FAILED, i, err_count = 0;
	int cnt, loopcnt;
	int cnt, loopcnt;
	unsigned int midlayer_id = 0;
	struct lpfc_scsi_buf * lpfc_cmd;
	struct lpfc_scsi_buf * lpfc_cmd;


	lpfc_block_requests(phba);
	lpfc_block_requests(phba);
@@ -1124,7 +1097,6 @@ lpfc_reset_bus_handler(struct scsi_cmnd *cmnd)
	 * targets known to the driver.  Should any target reset
	 * targets known to the driver.  Should any target reset
	 * fail, this routine returns failure to the midlayer.
	 * fail, this routine returns failure to the midlayer.
	 */
	 */
	midlayer_id = cmnd->device->id;
	for (i = 0; i < MAX_FCP_TARGET; i++) {
	for (i = 0; i < MAX_FCP_TARGET; i++) {
		/* Search the mapped list for this target ID */
		/* Search the mapped list for this target ID */
		match = 0;
		match = 0;
@@ -1137,9 +1109,8 @@ lpfc_reset_bus_handler(struct scsi_cmnd *cmnd)
		if (!match)
		if (!match)
			continue;
			continue;


		lpfc_cmd->pCmd->device->id = i;
		ret = lpfc_scsi_tgt_reset(lpfc_cmd, phba,
		lpfc_cmd->pCmd->device->hostdata = ndlp->rport->dd_data;
					  i, ndlp->rport->dd_data);
		ret = lpfc_scsi_tgt_reset(lpfc_cmd, phba);
		if (ret != SUCCESS) {
		if (ret != SUCCESS) {
			lpfc_printf_log(phba, KERN_ERR, LOG_FCP,
			lpfc_printf_log(phba, KERN_ERR, LOG_FCP,
				"%d:0713 Bus Reset on target %d failed\n",
				"%d:0713 Bus Reset on target %d failed\n",
@@ -1158,7 +1129,6 @@ lpfc_reset_bus_handler(struct scsi_cmnd *cmnd)
	 * the targets.  Unfortunately, some targets do not abide by
	 * the targets.  Unfortunately, some targets do not abide by
	 * this forcing the driver to double check.
	 * this forcing the driver to double check.
	 */
	 */
	cmnd->device->id = midlayer_id;
	cnt = lpfc_sli_sum_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring],
	cnt = lpfc_sli_sum_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring],
				0, 0, LPFC_CTX_HOST);
				0, 0, LPFC_CTX_HOST);
	if (cnt)
	if (cnt)
+1 −1
Original line number Original line Diff line number Diff line
@@ -18,7 +18,7 @@
 * included with this package.                                     *
 * included with this package.                                     *
 *******************************************************************/
 *******************************************************************/


#define LPFC_DRIVER_VERSION "8.1.5"
#define LPFC_DRIVER_VERSION "8.1.6"


#define LPFC_DRIVER_NAME "lpfc"
#define LPFC_DRIVER_NAME "lpfc"