]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
scsi: fnic: Correcting rport check location in fnic_queuecommand_lck
authorSatish Kharat <satishkh@cisco.com>
Tue, 7 Mar 2017 18:29:35 +0000 (10:29 -0800)
committerSomasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Thu, 18 May 2017 18:04:37 +0000 (11:04 -0700)
Orabug: 25638880

In fnic_queuecommand_lck the cleaning up the rport check and
handeling when it is null

Signed-off-by: Satish Kharat <satishkh@cisco.com>
[ Upstream commit 6008e96b8107a4e30a97de947bd0fac239836b58 ]
Signed-off-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Reviewed-by: Brian Maly <brian.maly@oracle.com>
drivers/scsi/fnic/fnic_scsi.c

index afe3bcd6db07e85e107ea415a98aff6b5a0fef2d..c2f3c10f3931b5b7659920a73a2408c5bce61525 100644 (file)
@@ -425,30 +425,38 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_
        unsigned long ptr;
        spinlock_t *io_lock = NULL;
        int io_lock_acquired = 0;
+       struct fc_rport_libfc_priv *rp;
 
        if (unlikely(fnic_chk_state_flags_locked(fnic, FNIC_FLAGS_IO_BLOCKED)))
                return SCSI_MLQUEUE_HOST_BUSY;
 
        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);
        if (ret) {
+               FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,
+                               "rport is not ready\n");
                atomic64_inc(&fnic_stats->misc_stats.rport_not_ready);
                sc->result = ret;
                done(sc);
                return 0;
        }
 
-       if (rport) {
-               struct fc_rport_libfc_priv *rp = rport->dd_data;
-
-               if (!rp || rp->rp_state != RPORT_ST_READY) {
-                       FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,
+       rp = rport->dd_data;
+       if (!rp || rp->rp_state != RPORT_ST_READY) {
+               FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,
                                "returning DID_NO_CONNECT for IO as rport is removed\n");
-                       atomic64_inc(&fnic_stats->misc_stats.rport_not_ready);
-                       sc->result = DID_NO_CONNECT<<16;
-                       done(sc);
-                       return 0;
-               }
+               atomic64_inc(&fnic_stats->misc_stats.rport_not_ready);
+               sc->result = DID_NO_CONNECT<<16;
+               done(sc);
+               return 0;
        }
 
        if (lp->state != LPORT_ST_READY || !(lp->link_up))