diff options
author | Satish Kharat <satishkh@cisco.com> | 2016-03-18 14:22:48 -0400 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2016-04-11 16:57:09 -0400 |
commit | 691a837c20df0f4eacd49596a4d57fc566a40545 (patch) | |
tree | 35c3b9d38686c56f10ed45129ed04b67bee3a8f5 /drivers/scsi/fnic | |
parent | 0008f1e7230b16989f72042e44bc078e44a69536 (diff) |
fnic: Fix to cleanup aborted IO to avoid device being offlined by mid-layer
If an I/O times out and an abort issued by host, if the abort is
successful we need to set scsi status as DID_ABORT. Or else the
mid-layer error handler which looks for this error code, will offline
the device. Also if the original I/O is not found in fnic firmware, we
will consider the abort as successful. The start_time assignment is
moved because of the new goto. Fnic driver version changed from
1.6.0.17a to 1.6.0.19, version 1.6.0.18 has been skipped
[mkp: Fixed checkpatch warning]
Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Sesidhar Baddela <sebaddel@cisco.com>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/fnic')
-rw-r--r-- | drivers/scsi/fnic/fnic.h | 2 | ||||
-rw-r--r-- | drivers/scsi/fnic/fnic_scsi.c | 33 |
2 files changed, 28 insertions, 7 deletions
diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h index ce129e595b55..52a53f8a907a 100644 --- a/drivers/scsi/fnic/fnic.h +++ b/drivers/scsi/fnic/fnic.h | |||
@@ -39,7 +39,7 @@ | |||
39 | 39 | ||
40 | #define DRV_NAME "fnic" | 40 | #define DRV_NAME "fnic" |
41 | #define DRV_DESCRIPTION "Cisco FCoE HBA Driver" | 41 | #define DRV_DESCRIPTION "Cisco FCoE HBA Driver" |
42 | #define DRV_VERSION "1.6.0.17a" | 42 | #define DRV_VERSION "1.6.0.19" |
43 | #define PFX DRV_NAME ": " | 43 | #define PFX DRV_NAME ": " |
44 | #define DFX DRV_NAME "%d: " | 44 | #define DFX DRV_NAME "%d: " |
45 | 45 | ||
diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c index f3032ca5051b..01b480d33d75 100644 --- a/drivers/scsi/fnic/fnic_scsi.c +++ b/drivers/scsi/fnic/fnic_scsi.c | |||
@@ -1091,6 +1091,11 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic, | |||
1091 | atomic64_inc( | 1091 | atomic64_inc( |
1092 | &term_stats->terminate_fw_timeouts); | 1092 | &term_stats->terminate_fw_timeouts); |
1093 | break; | 1093 | break; |
1094 | case FCPIO_ITMF_REJECTED: | ||
1095 | FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host, | ||
1096 | "abort reject recd. id %d\n", | ||
1097 | (int)(id & FNIC_TAG_MASK)); | ||
1098 | break; | ||
1094 | case FCPIO_IO_NOT_FOUND: | 1099 | case FCPIO_IO_NOT_FOUND: |
1095 | if (CMD_FLAGS(sc) & FNIC_IO_ABTS_ISSUED) | 1100 | if (CMD_FLAGS(sc) & FNIC_IO_ABTS_ISSUED) |
1096 | atomic64_inc(&abts_stats->abort_io_not_found); | 1101 | atomic64_inc(&abts_stats->abort_io_not_found); |
@@ -1111,9 +1116,15 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic, | |||
1111 | spin_unlock_irqrestore(io_lock, flags); | 1116 | spin_unlock_irqrestore(io_lock, flags); |
1112 | return; | 1117 | return; |
1113 | } | 1118 | } |
1114 | CMD_ABTS_STATUS(sc) = hdr_status; | 1119 | |
1115 | CMD_FLAGS(sc) |= FNIC_IO_ABT_TERM_DONE; | 1120 | CMD_FLAGS(sc) |= FNIC_IO_ABT_TERM_DONE; |
1116 | 1121 | ||
1122 | /* If the status is IO not found consider it as success */ | ||
1123 | if (hdr_status == FCPIO_IO_NOT_FOUND) | ||
1124 | CMD_ABTS_STATUS(sc) = FCPIO_SUCCESS; | ||
1125 | else | ||
1126 | CMD_ABTS_STATUS(sc) = hdr_status; | ||
1127 | |||
1117 | atomic64_dec(&fnic_stats->io_stats.active_ios); | 1128 | atomic64_dec(&fnic_stats->io_stats.active_ios); |
1118 | if (atomic64_read(&fnic->io_cmpl_skip)) | 1129 | if (atomic64_read(&fnic->io_cmpl_skip)) |
1119 | atomic64_dec(&fnic->io_cmpl_skip); | 1130 | atomic64_dec(&fnic->io_cmpl_skip); |
@@ -1926,21 +1937,31 @@ int fnic_abort_cmd(struct scsi_cmnd *sc) | |||
1926 | 1937 | ||
1927 | CMD_STATE(sc) = FNIC_IOREQ_ABTS_COMPLETE; | 1938 | CMD_STATE(sc) = FNIC_IOREQ_ABTS_COMPLETE; |
1928 | 1939 | ||
1940 | start_time = io_req->start_time; | ||
1929 | /* | 1941 | /* |
1930 | * firmware completed the abort, check the status, | 1942 | * firmware completed the abort, check the status, |
1931 | * free the io_req irrespective of failure or success | 1943 | * free the io_req if successful. If abort fails, |
1944 | * Device reset will clean the I/O. | ||
1932 | */ | 1945 | */ |
1933 | if (CMD_ABTS_STATUS(sc) != FCPIO_SUCCESS) | 1946 | if (CMD_ABTS_STATUS(sc) == FCPIO_SUCCESS) |
1947 | CMD_SP(sc) = NULL; | ||
1948 | else { | ||
1934 | ret = FAILED; | 1949 | ret = FAILED; |
1935 | 1950 | spin_unlock_irqrestore(io_lock, flags); | |
1936 | CMD_SP(sc) = NULL; | 1951 | goto fnic_abort_cmd_end; |
1952 | } | ||
1937 | 1953 | ||
1938 | spin_unlock_irqrestore(io_lock, flags); | 1954 | spin_unlock_irqrestore(io_lock, flags); |
1939 | 1955 | ||
1940 | start_time = io_req->start_time; | ||
1941 | fnic_release_ioreq_buf(fnic, io_req, sc); | 1956 | fnic_release_ioreq_buf(fnic, io_req, sc); |
1942 | mempool_free(io_req, fnic->io_req_pool); | 1957 | mempool_free(io_req, fnic->io_req_pool); |
1943 | 1958 | ||
1959 | if (sc->scsi_done) { | ||
1960 | /* Call SCSI completion function to complete the IO */ | ||
1961 | sc->result = (DID_ABORT << 16); | ||
1962 | sc->scsi_done(sc); | ||
1963 | } | ||
1964 | |||
1944 | fnic_abort_cmd_end: | 1965 | fnic_abort_cmd_end: |
1945 | FNIC_TRACE(fnic_abort_cmd, sc->device->host->host_no, | 1966 | FNIC_TRACE(fnic_abort_cmd, sc->device->host->host_no, |
1946 | sc->request->tag, sc, | 1967 | sc->request->tag, sc, |