From: Hannes Reinecke <hare@suse.de>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>,
James Bottomley <james.bottomley@hansenpartnership.com>,
James Smart <james.smart@broadcom.com>,
Dick Kennedy <dick.kennedy@broadcom.com>,
linux-scsi@vger.kernel.org, Hannes Reinecke <hare@suse.de>,
Hannes Reinecke <hare@suse.com>
Subject: [PATCH 14/14] lpfc: Complete scsi commands after RRQ has completed
Date: Thu, 2 Jun 2016 16:39:16 +0200 [thread overview]
Message-ID: <1464878356-42407-15-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1464878356-42407-1-git-send-email-hare@suse.de>
The lpfc driver cannot re-use xri until RRQ after aborts has
completed. With this patch the scsi command remains valid until
RRQ has completed and only then scsi_done() is called.
This will cause an extended timeout for the command under abort,
but the driver will never re-use invalid xris.
Signed-off-by: Hannes Reinecke <hare@suse.com>
---
drivers/scsi/lpfc/lpfc_scsi.c | 10 ++++++----
drivers/scsi/lpfc/lpfc_sli.c | 14 +++++++++++++-
2 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 348cae6..bbba1c2 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -1084,7 +1084,6 @@ lpfc_release_scsi_buf_s3(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb)
psb->prot_seg_cnt = 0;
spin_lock_irqsave(&phba->scsi_buf_list_put_lock, iflag);
- psb->pCmd = NULL;
psb->cur_iocbq.iocb_flag = LPFC_IO_FCP;
list_add_tail(&psb->list, &phba->lpfc_scsi_buf_list_put);
spin_unlock_irqrestore(&phba->scsi_buf_list_put_lock, iflag);
@@ -1114,13 +1113,11 @@ lpfc_release_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb)
return;
spin_lock_irqsave(&phba->sli4_hba.abts_scsi_buf_list_lock,
iflag);
- psb->pCmd = NULL;
list_add_tail(&psb->list,
&phba->sli4_hba.lpfc_abts_scsi_buf_list);
spin_unlock_irqrestore(&phba->sli4_hba.abts_scsi_buf_list_lock,
iflag);
} else {
- psb->pCmd = NULL;
psb->cur_iocbq.iocb_flag = LPFC_IO_FCP;
if (phba->lpfc_scsi_buf_arr)
clear_bit(LPFC_CMD_QUEUED, &psb->flags);
@@ -4166,8 +4163,13 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
* release the scsi_buf before calling 'done', thereby
* avoiding a race condition between aborts and scsi_done
*/
- if (shost->hostt->abort_completions)
+ if (shost->hostt->abort_completions) {
lpfc_release_scsi_buf(phba, lpfc_cmd);
+ if (test_bit(LPFC_CMD_EXCH_BUSY, &lpfc_cmd->flags) &&
+ test_bit(LPFC_CMD_ABORTED, &lpfc_cmd->flags))
+ return;
+ lpfc_cmd->pCmd = NULL;
+ }
/* The sdev is not guaranteed to be valid post scsi_done upcall. */
cmd->scsi_done(cmd);
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index e5cd212..01b55c2 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -662,6 +662,7 @@ lpfc_clr_rrq_active(struct lpfc_hba *phba,
int i;
struct lpfc_iocbq *iocbq;
struct lpfc_scsi_buf *psb;
+ struct scsi_cmnd *cmd;
spin_lock_irqsave(&phba->hbalock, iflag);
for (i = 1; i <= phba->sli.last_iotag; i++) {
@@ -674,7 +675,18 @@ lpfc_clr_rrq_active(struct lpfc_hba *phba,
psb = container_of(iocbq, struct lpfc_scsi_buf,
cur_iocbq);
- clear_bit(LPFC_CMD_RRQ_ACTIVE, &psb->flags);
+ if (!test_and_clear_bit(LPFC_CMD_RRQ_ACTIVE,
+ &psb->flags))
+ continue;
+
+ cmd = psb->pCmd;
+ if (cmd) {
+ psb->pCmd = NULL;
+ if (!cmd->result)
+ cmd->result = ScsiResult(DID_ABORT,
+ SAM_STAT_TASK_ABORTED);
+ cmd->scsi_done(cmd);
+ }
break;
}
spin_unlock_irqrestore(&phba->hbalock, iflag);
--
1.8.5.6
prev parent reply other threads:[~2016-06-02 14:39 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-02 14:39 [PATCH 00/14] lpfc multiqueue performance fixes Hannes Reinecke
2016-06-02 14:39 ` [PATCH 01/14] block: don't check request size in blk_cloned_rq_check_limits() Hannes Reinecke
2016-06-02 14:39 ` [PATCH 02/14] lpfc: remove unused 'pring' argument Hannes Reinecke
2016-06-02 14:39 ` [PATCH 03/14] lpfc: Add config option 'lpfc_enable_stats' Hannes Reinecke
2016-06-02 14:39 ` [PATCH 04/14] scsi: add 'abort_completions' host template flag Hannes Reinecke
2016-06-02 14:39 ` [PATCH 05/14] lpfc: do not wait for completion when aborting commands Hannes Reinecke
2016-06-02 14:39 ` [PATCH 06/14] lpfc: display manual queue assignment Hannes Reinecke
2016-06-02 14:39 ` [PATCH 07/14] scsi: modify can_queue after calling mq_allocate() Hannes Reinecke
2016-06-02 14:39 ` [PATCH 08/14] blk-mq: add blk_mq_resize_tag_set() Hannes Reinecke
2016-06-02 15:55 ` Bart Van Assche
2016-06-02 14:39 ` [PATCH 09/14] scsi: Implement scsi_mq_resize_tags() Hannes Reinecke
2016-06-02 15:58 ` Bart Van Assche
2016-06-02 14:39 ` [PATCH 10/14] lpfc: use bitflag for exch_busy Hannes Reinecke
2016-06-02 14:39 ` [PATCH 11/14] lpfc: set LPFC_CMD_ABORTED when a command is put on the aborted list Hannes Reinecke
2016-06-02 14:39 ` [PATCH 12/14] lpfc: move to array based command allocation for SLI-4 Hannes Reinecke
2016-06-02 14:39 ` [PATCH 13/14] lpfc: LPFC_CMD_RRQ_ACTIVE flag to mark commands Hannes Reinecke
2016-06-02 14:39 ` Hannes Reinecke [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1464878356-42407-15-git-send-email-hare@suse.de \
--to=hare@suse.de \
--cc=dick.kennedy@broadcom.com \
--cc=hare@suse.com \
--cc=hch@lst.de \
--cc=james.bottomley@hansenpartnership.com \
--cc=james.smart@broadcom.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).