Commit 691a837c authored by Satish Kharat's avatar Satish Kharat Committed by Martin K. Petersen

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: default avatarSatish Kharat <satishkh@cisco.com>
Signed-off-by: default avatarSesidhar Baddela <sebaddel@cisco.com>
Reviewed-by: default avatarEwan D. Milne <emilne@redhat.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 0008f1e7
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#define DRV_NAME "fnic" #define DRV_NAME "fnic"
#define DRV_DESCRIPTION "Cisco FCoE HBA Driver" #define DRV_DESCRIPTION "Cisco FCoE HBA Driver"
#define DRV_VERSION "1.6.0.17a" #define DRV_VERSION "1.6.0.19"
#define PFX DRV_NAME ": " #define PFX DRV_NAME ": "
#define DFX DRV_NAME "%d: " #define DFX DRV_NAME "%d: "
......
...@@ -1091,6 +1091,11 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic, ...@@ -1091,6 +1091,11 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic,
atomic64_inc( atomic64_inc(
&term_stats->terminate_fw_timeouts); &term_stats->terminate_fw_timeouts);
break; break;
case FCPIO_ITMF_REJECTED:
FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host,
"abort reject recd. id %d\n",
(int)(id & FNIC_TAG_MASK));
break;
case FCPIO_IO_NOT_FOUND: case FCPIO_IO_NOT_FOUND:
if (CMD_FLAGS(sc) & FNIC_IO_ABTS_ISSUED) if (CMD_FLAGS(sc) & FNIC_IO_ABTS_ISSUED)
atomic64_inc(&abts_stats->abort_io_not_found); atomic64_inc(&abts_stats->abort_io_not_found);
...@@ -1111,9 +1116,15 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic, ...@@ -1111,9 +1116,15 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic,
spin_unlock_irqrestore(io_lock, flags); spin_unlock_irqrestore(io_lock, flags);
return; return;
} }
CMD_ABTS_STATUS(sc) = hdr_status;
CMD_FLAGS(sc) |= FNIC_IO_ABT_TERM_DONE; CMD_FLAGS(sc) |= FNIC_IO_ABT_TERM_DONE;
/* If the status is IO not found consider it as success */
if (hdr_status == FCPIO_IO_NOT_FOUND)
CMD_ABTS_STATUS(sc) = FCPIO_SUCCESS;
else
CMD_ABTS_STATUS(sc) = hdr_status;
atomic64_dec(&fnic_stats->io_stats.active_ios); atomic64_dec(&fnic_stats->io_stats.active_ios);
if (atomic64_read(&fnic->io_cmpl_skip)) if (atomic64_read(&fnic->io_cmpl_skip))
atomic64_dec(&fnic->io_cmpl_skip); atomic64_dec(&fnic->io_cmpl_skip);
...@@ -1926,21 +1937,31 @@ int fnic_abort_cmd(struct scsi_cmnd *sc) ...@@ -1926,21 +1937,31 @@ int fnic_abort_cmd(struct scsi_cmnd *sc)
CMD_STATE(sc) = FNIC_IOREQ_ABTS_COMPLETE; CMD_STATE(sc) = FNIC_IOREQ_ABTS_COMPLETE;
start_time = io_req->start_time;
/* /*
* firmware completed the abort, check the status, * firmware completed the abort, check the status,
* free the io_req irrespective of failure or success * free the io_req if successful. If abort fails,
* Device reset will clean the I/O.
*/ */
if (CMD_ABTS_STATUS(sc) != FCPIO_SUCCESS) if (CMD_ABTS_STATUS(sc) == FCPIO_SUCCESS)
CMD_SP(sc) = NULL;
else {
ret = FAILED; ret = FAILED;
spin_unlock_irqrestore(io_lock, flags);
CMD_SP(sc) = NULL; goto fnic_abort_cmd_end;
}
spin_unlock_irqrestore(io_lock, flags); spin_unlock_irqrestore(io_lock, flags);
start_time = io_req->start_time;
fnic_release_ioreq_buf(fnic, io_req, sc); fnic_release_ioreq_buf(fnic, io_req, sc);
mempool_free(io_req, fnic->io_req_pool); mempool_free(io_req, fnic->io_req_pool);
if (sc->scsi_done) {
/* Call SCSI completion function to complete the IO */
sc->result = (DID_ABORT << 16);
sc->scsi_done(sc);
}
fnic_abort_cmd_end: fnic_abort_cmd_end:
FNIC_TRACE(fnic_abort_cmd, sc->device->host->host_no, FNIC_TRACE(fnic_abort_cmd, sc->device->host->host_no,
sc->request->tag, sc, sc->request->tag, sc,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment