snic: Fixing race in the hba reset and IO/TM completion
authorNarsimhulu Musini <nmusini@cisco.com>
Thu, 17 Mar 2016 07:51:15 +0000 (00:51 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Mon, 11 Apr 2016 20:57:09 +0000 (16:57 -0400)
While HBA reset is in progress, if IO/TM completion is received for the
same IO then IO/TM completion path releases the driver private resources
associated with IO. This fix prevents releasing the resources in
IO and TM completion path if HBA reset is in progress.

Signed-off-by: Narsimhulu Musini <nmusini@cisco.com>
Signed-off-by: Sesidhar Baddela <sebaddel@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/snic/snic.h
drivers/scsi/snic/snic_scsi.c

index d7f5ba6ba84c64bce1f81947d274d30b1c539fe5..8ed778d4dbb9688864b20a34afaf9e724022d953 100644 (file)
@@ -95,6 +95,8 @@
 #define SNIC_DEV_RST_NOTSUP            BIT(25)
 #define SNIC_SCSI_CLEANUP              BIT(26)
 #define SNIC_HOST_RESET_ISSUED         BIT(27)
+#define SNIC_HOST_RESET_CMD_TERM       \
+       (SNIC_DEV_RST_NOTSUP | SNIC_SCSI_CLEANUP | SNIC_HOST_RESET_ISSUED)
 
 #define SNIC_ABTS_TIMEOUT              30000           /* msec */
 #define SNIC_LUN_RESET_TIMEOUT         30000           /* msec */
@@ -216,9 +218,10 @@ enum snic_msix_intr_index {
        SNIC_MSIX_INTR_MAX,
 };
 
+#define SNIC_INTRHDLR_NAMSZ    (2 * IFNAMSIZ)
 struct snic_msix_entry {
        int requested;
-       char devname[IFNAMSIZ];
+       char devname[SNIC_INTRHDLR_NAMSZ];
        irqreturn_t (*isr)(int, void *);
        void *devid;
 };
index 5a709ebdb282a3f8a5fddd449a4d5afc1d3d3474..abada16b375b1a3c47ec22e19778dc3fd0c3062f 100644 (file)
@@ -601,6 +601,12 @@ snic_icmnd_cmpl_handler(struct snic *snic, struct snic_fw_req *fwreq)
                      sc->device->lun, sc, sc->cmnd[0], snic_cmd_tag(sc),
                      CMD_FLAGS(sc), rqi);
 
+       if (CMD_FLAGS(sc) & SNIC_HOST_RESET_CMD_TERM) {
+               spin_unlock_irqrestore(io_lock, flags);
+
+               return;
+       }
+
        SNIC_BUG_ON(rqi != (struct snic_req_info *)ctx);
        WARN_ON_ONCE(req);
        if (!rqi) {
@@ -782,6 +788,11 @@ snic_process_itmf_cmpl(struct snic *snic,
 
        io_lock = snic_io_lock_hash(snic, sc);
        spin_lock_irqsave(io_lock, flags);
+       if (CMD_FLAGS(sc) & SNIC_HOST_RESET_CMD_TERM) {
+               spin_unlock_irqrestore(io_lock, flags);
+
+               return ret;
+       }
        rqi = (struct snic_req_info *) CMD_SP(sc);
        WARN_ON_ONCE(!rqi);