Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

snic: Fixing race in the hba reset and IO/TM completion

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>

authored by

Narsimhulu Musini and committed by
Martin K. Petersen
0da8519b c9747821

+15 -1
+4 -1
drivers/scsi/snic/snic.h
··· 95 95 #define SNIC_DEV_RST_NOTSUP BIT(25) 96 96 #define SNIC_SCSI_CLEANUP BIT(26) 97 97 #define SNIC_HOST_RESET_ISSUED BIT(27) 98 + #define SNIC_HOST_RESET_CMD_TERM \ 99 + (SNIC_DEV_RST_NOTSUP | SNIC_SCSI_CLEANUP | SNIC_HOST_RESET_ISSUED) 98 100 99 101 #define SNIC_ABTS_TIMEOUT 30000 /* msec */ 100 102 #define SNIC_LUN_RESET_TIMEOUT 30000 /* msec */ ··· 218 216 SNIC_MSIX_INTR_MAX, 219 217 }; 220 218 219 + #define SNIC_INTRHDLR_NAMSZ (2 * IFNAMSIZ) 221 220 struct snic_msix_entry { 222 221 int requested; 223 - char devname[IFNAMSIZ]; 222 + char devname[SNIC_INTRHDLR_NAMSZ]; 224 223 irqreturn_t (*isr)(int, void *); 225 224 void *devid; 226 225 };
+11
drivers/scsi/snic/snic_scsi.c
··· 601 601 sc->device->lun, sc, sc->cmnd[0], snic_cmd_tag(sc), 602 602 CMD_FLAGS(sc), rqi); 603 603 604 + if (CMD_FLAGS(sc) & SNIC_HOST_RESET_CMD_TERM) { 605 + spin_unlock_irqrestore(io_lock, flags); 606 + 607 + return; 608 + } 609 + 604 610 SNIC_BUG_ON(rqi != (struct snic_req_info *)ctx); 605 611 WARN_ON_ONCE(req); 606 612 if (!rqi) { ··· 788 782 789 783 io_lock = snic_io_lock_hash(snic, sc); 790 784 spin_lock_irqsave(io_lock, flags); 785 + if (CMD_FLAGS(sc) & SNIC_HOST_RESET_CMD_TERM) { 786 + spin_unlock_irqrestore(io_lock, flags); 787 + 788 + return ret; 789 + } 791 790 rqi = (struct snic_req_info *) CMD_SP(sc); 792 791 WARN_ON_ONCE(!rqi); 793 792