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

Commit 6008e96b authored by Satish Kharat's avatar Satish Kharat Committed by Martin K. Petersen
Browse files

scsi: fnic: Correcting rport check location in fnic_queuecommand_lck

parent 141f8165
Loading
Loading
Loading
Loading
+18 −10
Original line number Original line Diff line number Diff line
@@ -441,22 +441,31 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_
	unsigned long ptr;
	unsigned long ptr;
	spinlock_t *io_lock = NULL;
	spinlock_t *io_lock = NULL;
	int io_lock_acquired = 0;
	int io_lock_acquired = 0;
	struct fc_rport_libfc_priv *rp;


	if (unlikely(fnic_chk_state_flags_locked(fnic, FNIC_FLAGS_IO_BLOCKED)))
	if (unlikely(fnic_chk_state_flags_locked(fnic, FNIC_FLAGS_IO_BLOCKED)))
		return SCSI_MLQUEUE_HOST_BUSY;
		return SCSI_MLQUEUE_HOST_BUSY;


	rport = starget_to_rport(scsi_target(sc->device));
	rport = starget_to_rport(scsi_target(sc->device));
	if (!rport) {
		FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,
				"returning DID_NO_CONNECT for IO as rport is NULL\n");
		sc->result = DID_NO_CONNECT << 16;
		done(sc);
		return 0;
	}

	ret = fc_remote_port_chkready(rport);
	ret = fc_remote_port_chkready(rport);
	if (ret) {
	if (ret) {
		FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,
				"rport is not ready\n");
		atomic64_inc(&fnic_stats->misc_stats.rport_not_ready);
		atomic64_inc(&fnic_stats->misc_stats.rport_not_ready);
		sc->result = ret;
		sc->result = ret;
		done(sc);
		done(sc);
		return 0;
		return 0;
	}
	}


	if (rport) {
	rp = rport->dd_data;
		struct fc_rport_libfc_priv *rp = rport->dd_data;

	if (!rp || rp->rp_state != RPORT_ST_READY) {
	if (!rp || rp->rp_state != RPORT_ST_READY) {
		FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,
		FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,
				"returning DID_NO_CONNECT for IO as rport is removed\n");
				"returning DID_NO_CONNECT for IO as rport is removed\n");
@@ -465,7 +474,6 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_
		done(sc);
		done(sc);
		return 0;
		return 0;
	}
	}
	}


	if (lp->state != LPORT_ST_READY || !(lp->link_up))
	if (lp->state != LPORT_ST_READY || !(lp->link_up))
		return SCSI_MLQUEUE_HOST_BUSY;
		return SCSI_MLQUEUE_HOST_BUSY;