diff options
| author | Milos Muzik <Milos.Muzik@Sun.COM> | 2009-12-07 23:53:59 +0100 |
|---|---|---|
| committer | Milos Muzik <Milos.Muzik@Sun.COM> | 2009-12-07 23:53:59 +0100 |
| commit | b97c1f925a1d211d325cdc3a2e4b3b779082510b (patch) | |
| tree | bf8a30c33eab0fbfb544963d7eeceb5e926107ff /usr/src | |
| parent | 146832db19eb2048b216b5dd0ba4424c7d0dfd17 (diff) | |
| download | illumos-joyent-b97c1f925a1d211d325cdc3a2e4b3b779082510b.tar.gz | |
6903996 iscsi panics when Unit Attention/Reset (0x29) is received as a response to internally issued cdb
Diffstat (limited to 'usr/src')
| -rw-r--r-- | usr/src/uts/common/io/scsi/adapters/iscsi/iscsi.h | 1 | ||||
| -rw-r--r-- | usr/src/uts/common/io/scsi/adapters/iscsi/iscsi_io.c | 23 |
2 files changed, 18 insertions, 6 deletions
diff --git a/usr/src/uts/common/io/scsi/adapters/iscsi/iscsi.h b/usr/src/uts/common/io/scsi/adapters/iscsi/iscsi.h index 66e53b3889..3b4966eb9b 100644 --- a/usr/src/uts/common/io/scsi/adapters/iscsi/iscsi.h +++ b/usr/src/uts/common/io/scsi/adapters/iscsi/iscsi.h @@ -137,6 +137,7 @@ extern boolean_t iscsi_sess_logging; #define ISCSI_LUN_MASK_MSB 0x00003f00 #define ISCSI_LUN_MASK_LSB 0x000000ff +#define ISCSI_LUN_MASK (ISCSI_LUN_MASK_MSB | ISCSI_LUN_MASK_LSB) #define ISCSI_LUN_BYTE_COPY(lun, report_lun_data) \ lun[0] = (report_lun_data & ISCSI_LUN_MASK_MSB) >> 8; \ lun[1] = (report_lun_data & ISCSI_LUN_MASK_LSB); diff --git a/usr/src/uts/common/io/scsi/adapters/iscsi/iscsi_io.c b/usr/src/uts/common/io/scsi/adapters/iscsi/iscsi_io.c index 4afd20c6c5..0a292bfac4 100644 --- a/usr/src/uts/common/io/scsi/adapters/iscsi/iscsi_io.c +++ b/usr/src/uts/common/io/scsi/adapters/iscsi/iscsi_io.c @@ -754,10 +754,13 @@ iscsi_rx_process_cmd_rsp(idm_conn_t *ic, idm_pdu_t *pdu) /* success */ iscsi_cmd_rsp_chk(icmdp, issrhp); flush = iscsi_cmd_rsp_cmd_status(icmdp, issrhp, data); + + ASSERT(icmdp->cmd_lun == NULL || icmdp->cmd_lun->lun_num == + (icmdp->cmd_un.scsi.lun & ISCSI_LUN_MASK)); + if (flush == B_TRUE) { cmd_sn = icmdp->cmd_sn; - ASSERT(icmdp->cmd_lun != NULL); - lun_num = icmdp->cmd_lun->lun_num; + lun_num = icmdp->cmd_un.scsi.lun & ISCSI_LUN_MASK; } } @@ -3552,8 +3555,8 @@ iscsi_nop_timeout_checks(iscsi_cmd_t *icmdp) /* * iscsi_flush_cmd_after_reset - flush commands after reset * - * Here we will flush all the commands in the same connection whose cmdsn is - * less than the one received with the Unit Attention. + * Here we will flush all the commands for a specified LUN whose cmdsn is less + * than the one received with the Unit Attention. */ static void iscsi_flush_cmd_after_reset(uint32_t cmd_sn, uint16_t lun_num, @@ -3578,8 +3581,16 @@ iscsi_flush_cmd_after_reset(uint32_t cmd_sn, uint16_t lun_num, ((cmd_sn > t_icmdp->cmd_sn) || ((t_icmdp->cmd_sn - cmd_sn) > ISCSI_CMD_SN_WRAP))) { - if (t_icmdp->cmd_lun != NULL && - t_icmdp->cmd_lun->lun_num == lun_num) { + /* + * Internally generated SCSI commands do not have + * t_icmdp->cmd_lun set, but the LUN can be retrieved + * from t_icmdp->cmd_un.scsi.lun. + */ + if ((t_icmdp->cmd_lun != NULL && + t_icmdp->cmd_lun->lun_num == lun_num) || + (t_icmdp->cmd_type == ISCSI_CMD_TYPE_SCSI && + (t_icmdp->cmd_un.scsi.lun & ISCSI_LUN_MASK) == + lun_num)) { t_icmdp->cmd_misc_flags |= ISCSI_CMD_MISCFLAG_FLUSH; if (t_icmdp->cmd_type == ISCSI_CMD_TYPE_SCSI) { |
