From: Bart Van Assche <bvanassche@acm.org>
To: Himanshu Madhani <hmadhani@marvell.com>,
James.Bottomley@HansenPartnership.com,
martin.petersen@oracle.com
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH 2/8] qla2xxx: Do command completion on abort timeout
Date: Tue, 5 Nov 2019 08:57:22 -0800 [thread overview]
Message-ID: <51483fdc-f102-0a08-7c19-d3e9f1792a86@acm.org> (raw)
In-Reply-To: <20191105150657.8092-3-hmadhani@marvell.com>
On 11/5/19 7:06 AM, Himanshu Madhani wrote:
> From: Quinn Tran <qutran@marvell.com>
>
> On switch, fabric and mgt command timeout, driver
> send Abort to tell FW to return the original command.
> If abort is timeout, then return both Abort and
> original command for cleanup.
>
> Fixes: 219d27d7147e0 ("scsi: qla2xxx: Fix race conditions in the code for aborting SCSI commands")
> Cc: stable@vger.kernel.org # 5.2
> Signed-off-by: Quinn Tran <qutran@marvell.com>
> Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
> ---
> drivers/scsi/qla2xxx/qla_def.h | 1 +
> drivers/scsi/qla2xxx/qla_init.c | 18 ++++++++++++++++++
> 2 files changed, 19 insertions(+)
>
> diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
> index 721ee7f09b39..ef9bb3c7ad6f 100644
> --- a/drivers/scsi/qla2xxx/qla_def.h
> +++ b/drivers/scsi/qla2xxx/qla_def.h
> @@ -604,6 +604,7 @@ typedef struct srb {
> const char *name;
> int iocbs;
> struct qla_qpair *qpair;
> + struct srb *cmd_sp;
> struct list_head elem;
> u32 gen1; /* scratch */
> u32 gen2; /* scratch */
> diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
> index 5db8ad832893..7fdbe041cc19 100644
> --- a/drivers/scsi/qla2xxx/qla_init.c
> +++ b/drivers/scsi/qla2xxx/qla_init.c
> @@ -101,8 +101,22 @@ static void qla24xx_abort_iocb_timeout(void *data)
> u32 handle;
> unsigned long flags;
>
> + if (sp->cmd_sp)
> + ql_dbg(ql_dbg_async, sp->vha, 0x507c,
> + "Abort timeout - cmd hdl=%x, cmd type=%x hdl=%x, type=%x\n",
> + sp->cmd_sp->handle, sp->cmd_sp->type,
> + sp->handle, sp->type);
> + else
> + ql_dbg(ql_dbg_async, sp->vha, 0x507c,
> + "Abort timeout 2 - hdl=%x, type=%x\n",
> + sp->handle, sp->type);
> +
> spin_lock_irqsave(qpair->qp_lock_ptr, flags);
> for (handle = 1; handle < qpair->req->num_outstanding_cmds; handle++) {
> + if (sp->cmd_sp && (qpair->req->outstanding_cmds[handle] ==
> + sp->cmd_sp))
> + qpair->req->outstanding_cmds[handle] = NULL;
> +
> /* removing the abort */
> if (qpair->req->outstanding_cmds[handle] == sp) {
> qpair->req->outstanding_cmds[handle] = NULL;
> @@ -111,6 +125,9 @@ static void qla24xx_abort_iocb_timeout(void *data)
> }
> spin_unlock_irqrestore(qpair->qp_lock_ptr, flags);
>
> + if (sp->cmd_sp)
> + sp->cmd_sp->done(sp->cmd_sp, QLA_OS_TIMER_EXPIRED);
> +
> abt->u.abt.comp_status = CS_TIMEOUT;
> sp->done(sp, QLA_OS_TIMER_EXPIRED);
> }
> @@ -142,6 +159,7 @@ static int qla24xx_async_abort_cmd(srb_t *cmd_sp, bool wait)
> sp->type = SRB_ABT_CMD;
> sp->name = "abort";
> sp->qpair = cmd_sp->qpair;
> + sp->cmd_sp = cmd_sp;
> if (wait)
> sp->flags = SRB_WAKEUP_ON_COMP;
>
After an abort SRB has been submitted it can happen that the command
that should be aborted (cmd_sp) completes before the abort SRB
completes. I think in that case sp->cmd_sp should be cleared. However, I
don't see the code that does that in the above patch.
Since the block layer already keeps track of which commands are
outstanding, is it really necessary to add the 'cmd_sp' pointer in
struct srb? Has it been considered to use blk_mq_tagset_busy_iter()
instead of iterating over qpair->req->num_outstanding_cmds in
qla24xx_abort_iocb_timeout()?
Thanks,
Bart.
next prev parent reply other threads:[~2019-11-05 16:57 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-05 15:06 [PATCH 0/8] qla2xxx: Bug Fixes for the driver Himanshu Madhani
2019-11-05 15:06 ` [PATCH 1/8] qla2xxx: Retry PLOGI on FC-NVMe PRLI failure Himanshu Madhani
2019-11-05 15:18 ` Ewan D. Milne
2019-11-05 15:06 ` [PATCH 2/8] qla2xxx: Do command completion on abort timeout Himanshu Madhani
2019-11-05 15:18 ` Ewan D. Milne
2019-11-05 16:57 ` Bart Van Assche [this message]
2019-11-07 16:46 ` [EXT] " Himanshu Madhani
2019-11-05 15:06 ` [PATCH 3/8] qla2xxx: Fix SRB leak on switch command timeout Himanshu Madhani
2019-11-05 15:19 ` Ewan D. Milne
2019-11-05 15:06 ` [PATCH 4/8] qla2xxx: Fix driver unload hang Himanshu Madhani
2019-11-05 15:19 ` Ewan D. Milne
2019-11-07 16:54 ` Bart Van Assche
[not found] ` <83CC0DDF-4907-41A2-91EC-1569A07A6BA9@marvell.com>
2019-11-07 17:58 ` Bart Van Assche
2019-11-07 18:30 ` Bart Van Assche
2019-11-08 23:38 ` [EXT] " Himanshu Madhani
2019-11-08 23:58 ` Bart Van Assche
2019-11-05 15:06 ` [PATCH 5/8] qla2xxx: Fix double scsi_done for abort path Himanshu Madhani
2019-11-05 15:20 ` Ewan D. Milne
2019-11-07 18:01 ` Bart Van Assche
2019-11-05 15:06 ` [PATCH 6/8] qla2xxx: Fix memory leak when sending I/O fails Himanshu Madhani
2019-11-05 15:20 ` Ewan D. Milne
2019-11-18 20:25 ` Himanshu Madhani
2019-11-19 5:02 ` Martin K. Petersen
2019-11-05 15:06 ` [PATCH 7/8] qla2xxx: Fix device connect issues in P2P configuration Himanshu Madhani
2019-11-05 15:21 ` Ewan D. Milne
2019-11-05 15:06 ` [PATCH 8/8] qla2xxx: Update driver version to 10.01.00.21-k Himanshu Madhani
2019-11-05 15:21 ` Ewan D. Milne
2019-11-09 2:16 ` [PATCH 0/8] qla2xxx: Bug Fixes for the driver Martin K. Petersen
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=51483fdc-f102-0a08-7c19-d3e9f1792a86@acm.org \
--to=bvanassche@acm.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=hmadhani@marvell.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