public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
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>,
	Ming Lei <ming.lei@redhat.com>,
	linux-scsi@vger.kernel.org, Hannes Reinecke <hare@suse.de>
Subject: [PATCH 3/3] fnic: check for started requests in fnic_wq_copy_cleanup_handler()
Date: Thu, 29 Apr 2021 14:25:17 +0200	[thread overview]
Message-ID: <20210429122517.39659-4-hare@suse.de> (raw)
In-Reply-To: <20210429122517.39659-1-hare@suse.de>

fnic_wq_copy_cleanup_handler() is using scsi_host_find_tag() to
map id to a scsi command. However, as per discussion on the mailinglist
scsi_host_find_tag() might return a non-started request, so we need
to check the returned command with blk_mq_request_started() to avoid
the function tripping over a non-initialized command.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/scsi/fnic/fnic_scsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index 762cc8bd2653..b9fd3d87416b 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -1466,7 +1466,7 @@ void fnic_wq_copy_cleanup_handler(struct vnic_wq_copy *wq,
 		return;
 
 	sc = scsi_host_find_tag(fnic->lport->host, id);
-	if (!sc)
+	if (!sc || !blk_mq_request_started(sc->request))
 		return;
 
 	io_lock = fnic_io_lock_hash(fnic, sc);
-- 
2.29.2


  parent reply	other threads:[~2021-04-29 12:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-29 12:25 [PATCH 0/3] fnic: use scsi_host_busy_iter() to traverse commands Hannes Reinecke
2021-04-29 12:25 ` [PATCH 1/3] fnic: kill 'exclude_id' argument to fnic_cleanup_io() Hannes Reinecke
2021-04-30  6:10   ` Ming Lei
2021-04-29 12:25 ` [PATCH 2/3] fnic: use scsi_host_busy_iter() to traverse commands Hannes Reinecke
2021-04-30  6:17   ` Ming Lei
2021-04-29 12:25 ` Hannes Reinecke [this message]
2021-04-29 14:34   ` [PATCH 3/3] fnic: check for started requests in fnic_wq_copy_cleanup_handler() Ming Lei
2021-04-29 17:28     ` Hannes Reinecke
2021-05-04  7:49       ` Martin Wilck
2021-05-04  8:06         ` Ming Lei
2021-05-04  8:57           ` Martin Wilck
2021-05-04 17:03             ` Bart Van Assche

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=20210429122517.39659-4-hare@suse.de \
    --to=hare@suse.de \
    --cc=hch@lst.de \
    --cc=james.bottomley@hansenpartnership.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=ming.lei@redhat.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