Skip to content

Commit 0da8519

Browse files
Narsimhulu Musinimartinkpetersen
authored andcommitted
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 <[email protected]> Signed-off-by: Sesidhar Baddela <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent c974782 commit 0da8519

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

drivers/scsi/snic/snic.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@
9595
#define SNIC_DEV_RST_NOTSUP BIT(25)
9696
#define SNIC_SCSI_CLEANUP BIT(26)
9797
#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)
98100

99101
#define SNIC_ABTS_TIMEOUT 30000 /* msec */
100102
#define SNIC_LUN_RESET_TIMEOUT 30000 /* msec */
@@ -216,9 +218,10 @@ enum snic_msix_intr_index {
216218
SNIC_MSIX_INTR_MAX,
217219
};
218220

221+
#define SNIC_INTRHDLR_NAMSZ (2 * IFNAMSIZ)
219222
struct snic_msix_entry {
220223
int requested;
221-
char devname[IFNAMSIZ];
224+
char devname[SNIC_INTRHDLR_NAMSZ];
222225
irqreturn_t (*isr)(int, void *);
223226
void *devid;
224227
};

drivers/scsi/snic/snic_scsi.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,12 @@ snic_icmnd_cmpl_handler(struct snic *snic, struct snic_fw_req *fwreq)
601601
sc->device->lun, sc, sc->cmnd[0], snic_cmd_tag(sc),
602602
CMD_FLAGS(sc), rqi);
603603

604+
if (CMD_FLAGS(sc) & SNIC_HOST_RESET_CMD_TERM) {
605+
spin_unlock_irqrestore(io_lock, flags);
606+
607+
return;
608+
}
609+
604610
SNIC_BUG_ON(rqi != (struct snic_req_info *)ctx);
605611
WARN_ON_ONCE(req);
606612
if (!rqi) {
@@ -782,6 +788,11 @@ snic_process_itmf_cmpl(struct snic *snic,
782788

783789
io_lock = snic_io_lock_hash(snic, sc);
784790
spin_lock_irqsave(io_lock, flags);
791+
if (CMD_FLAGS(sc) & SNIC_HOST_RESET_CMD_TERM) {
792+
spin_unlock_irqrestore(io_lock, flags);
793+
794+
return ret;
795+
}
785796
rqi = (struct snic_req_info *) CMD_SP(sc);
786797
WARN_ON_ONCE(!rqi);
787798

0 commit comments

Comments
 (0)