]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
fnic/fnic_scsi.c: set missing new_sc flag
authorSatish Kharat <satishkh@cisco.com>
Wed, 29 Jun 2016 17:41:52 +0000 (10:41 -0700)
committerChuck Anderson <chuck.anderson@oracle.com>
Wed, 6 Jul 2016 23:44:50 +0000 (16:44 -0700)
Orabug: 23071668

The new_sc flag was introduced as part of the fix for a bug . It is set
in fnic_device_reset when the tag for the command is not set, like the case of
sg_resest tool from sg3_utils. In one of the case missed setting that flag in the
original fix. This bug is to add that missing code to set new_sc in that case.

Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Ethan Zhao <ethan.zhao@oracle.com>
drivers/scsi/fnic/fnic_scsi.c

index 1637e295e288b01ea57aa1b9273279454fa9cea4..146da6ec19d5b9ef35f39fdb4862ade191acdc13 100644 (file)
@@ -437,6 +437,7 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_
                done(sc);
                return 0;
        }
+
        if (rport) {
                struct fc_rport_libfc_priv *rp = rport->dd_data;
 
@@ -449,6 +450,7 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_
                        return 0;
                }
        }
+
        if (lp->state != LPORT_ST_READY || !(lp->link_up))
                return SCSI_MLQUEUE_HOST_BUSY;
 
@@ -1102,11 +1104,13 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic,
                        return;
                }
 
-               CMD_ABTS_STATUS(sc) = hdr_status;
                CMD_FLAGS(sc) |= FNIC_IO_ABT_TERM_DONE;
+
                /* If the status is IO not found consider it as success */
                if (hdr_status == FCPIO_IO_NOT_FOUND)
                        CMD_ABTS_STATUS(sc) = FCPIO_SUCCESS;
+               else
+                       CMD_ABTS_STATUS(sc) = hdr_status;
 
                atomic64_dec(&fnic_stats->io_stats.active_ios);
                if (atomic64_read(&fnic->io_cmpl_skip))
@@ -1919,6 +1923,7 @@ int fnic_abort_cmd(struct scsi_cmnd *sc)
        }
 
        CMD_STATE(sc) = FNIC_IOREQ_ABTS_COMPLETE;
+
        start_time = io_req->start_time;
        /*
         * firmware completed the abort, check the status,
@@ -1934,9 +1939,12 @@ int fnic_abort_cmd(struct scsi_cmnd *sc)
                spin_unlock_irqrestore(io_lock, flags);
                goto fnic_abort_cmd_end;
        }
+
        spin_unlock_irqrestore(io_lock, flags);
+
        fnic_release_ioreq_buf(fnic, io_req, sc);
        mempool_free(io_req, fnic->io_req_pool);
+
        if (sc->scsi_done) {
        /* Call SCSI completion function to complete the IO */
                sc->result = (DID_ABORT << 16);
@@ -2153,6 +2161,7 @@ static int fnic_clean_pending_aborts(struct fnic *fnic,
                if (sc != lr_sc)
                        CMD_SP(sc) = NULL;
                spin_unlock_irqrestore(io_lock, flags);
+
                /* original sc used for lr is handled by dev reset code */
                if (sc != lr_sc) {
                        fnic_release_ioreq_buf(fnic, io_req, sc);
@@ -2262,6 +2271,7 @@ int fnic_device_reset(struct scsi_cmnd *sc)
        DECLARE_COMPLETION_ONSTACK(tm_done);
        int tag_gen_flag = 0;   /*to track tags allocated by fnic driver*/
        bool new_sc = 0;
+
        /* Wait for rport to unblock */
        fc_block_scsi_eh(sc);
 
@@ -2306,13 +2316,12 @@ int fnic_device_reset(struct scsi_cmnd *sc)
                 * fix the way the EH ioctls work for real, but until
                 * that happens we fail these explicit requests here.
                 */
-               if (shost_use_blk_mq(sc->device->host))
-                       goto fnic_device_reset_end;
 
                tag = fnic_scsi_host_start_tag(fnic, sc);
                if (unlikely(tag == SCSI_NO_TAG))
                        goto fnic_device_reset_end;
                tag_gen_flag = 1;
+               new_sc = 1;
        }
        io_lock = fnic_io_lock_hash(fnic, sc);
        spin_lock_irqsave(io_lock, flags);