From 0f682d3551d90c5aaf4025f8be898a1af32eaa65 Mon Sep 17 00:00:00 2001 From: Satish Kharat Date: Tue, 7 Mar 2017 11:32:03 -0800 Subject: [PATCH] fnic: Avoid false out-of-order detection for aborted command Orabug: 25638880 If SCSI-ML has already issued abort on a command i.e FNIC_IOREQ_ABTS_PENDING is set and we get a IO completion avoid this being flagged as out-of-order completion by setting the FNIC_IO_DONE flag in fnic_fcpio_icmnd_cmpl_handler Signed-off-by: Satish Kharat Signed-off-by: Somasundaram Krishnasamy Reviewed-by: Brian Maly --- drivers/scsi/fnic/fnic_scsi.c | 42 ++++++++++++++++------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c index c2f3c10f3931..13a5e8269ca7 100644 --- a/drivers/scsi/fnic/fnic_scsi.c +++ b/drivers/scsi/fnic/fnic_scsi.c @@ -860,32 +860,28 @@ static void fnic_fcpio_icmnd_cmpl_handler(struct fnic *fnic, /* * if SCSI-ML has already issued abort on this command, - * ignore completion of the IO. The abts path will clean it up + * set completion of the IO. The abts path will clean it up */ if (CMD_STATE(sc) == FNIC_IOREQ_ABTS_PENDING) { - spin_unlock_irqrestore(io_lock, flags); + + /* + * set the FNIC_IO_DONE so that this doesn't get + * flagged as 'out of order' if it was not aborted + */ + CMD_FLAGS(sc) |= FNIC_IO_DONE; CMD_FLAGS(sc) |= FNIC_IO_ABTS_PENDING; - switch (hdr_status) { - case FCPIO_SUCCESS: - CMD_FLAGS(sc) |= FNIC_IO_DONE; - FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host, - "icmnd_cmpl ABTS pending hdr status = %s " - "sc 0x%p scsi_status %x residual %d\n", - fnic_fcpio_status_to_str(hdr_status), sc, - icmnd_cmpl->scsi_status, - icmnd_cmpl->residual); - break; - case FCPIO_ABORTED: + spin_unlock_irqrestore(io_lock, flags); + if(FCPIO_ABORTED == hdr_status) CMD_FLAGS(sc) |= FNIC_IO_ABORTED; - break; - default: - FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host, - "icmnd_cmpl abts pending " - "hdr status = %s tag = 0x%x sc = 0x%p\n", - fnic_fcpio_status_to_str(hdr_status), - id, sc); - break; - } + + FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host, + "icmnd_cmpl abts pending " + "hdr status = %s tag = 0x%x sc = 0x%p" + "scsi_status = %x residual = %d\n", + fnic_fcpio_status_to_str(hdr_status), + id, sc, + icmnd_cmpl->scsi_status, + icmnd_cmpl->residual); return; } @@ -1936,7 +1932,7 @@ int fnic_abort_cmd(struct scsi_cmnd *sc) * 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_ABTS_STATUS(sc) == FCPIO_ABORTED)) { CMD_SP(sc) = NULL; } else -- 2.50.1