All of lore.kernel.org
 help / color / mirror / Atom feed
From: mwilck@suse.com
To: "Martin K. Petersen" <martin.petersen@oracle.com>,
	Arun Easi <aeasi@marvell.com>, Quinn Tran <qutran@marvell.com>
Cc: Himanshu Madhani <himanshu.madhani@oracle.com>,
	Roman Bolshakov <r.bolshakov@yadro.com>,
	Daniel Wagner <dwagner@suse.de>,
	Bart Van Assche <Bart.VanAssche@sandisk.com>,
	James Bottomley <jejb@linux.vnet.ibm.com>,
	linux-scsi@vger.kernel.org, Martin Wilck <mwilck@suse.com>
Subject: [PATCH v4 2/2] scsi: qla2xxx: check UNLOADING before posting async work
Date: Tue, 21 Apr 2020 22:46:21 +0200	[thread overview]
Message-ID: <20200421204621.19228-3-mwilck@suse.com> (raw)
In-Reply-To: <20200421204621.19228-1-mwilck@suse.com>

From: Martin Wilck <mwilck@suse.com>

qlt_free_session_done() tries to post async PRLO / LOGO, and
waits for the completion of these async commands. If UNLOADING
is set, this is doomed to timeout, because the async logout
command will never complete.

The only way to avoid waiting pointlessly is to fail posting
these commands in the first place if the driver is in UNLOADING state.
In general, posting any command should be avoided when the driver
is UNLOADING.

With this patch, "rmmod qla2xxx" completes without noticeable delay.

Fixes: 45235022da99 ("scsi: qla2xxx: Fix driver unload by shutting down chip")
Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 drivers/scsi/qla2xxx/qla_os.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index ce0dabb..8cce3e2 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -4862,6 +4862,9 @@ qla2x00_alloc_work(struct scsi_qla_host *vha, enum qla_work_type type)
 	struct qla_work_evt *e;
 	uint8_t bail;
 
+	if (test_bit(UNLOADING, &vha->dpc_flags))
+		return NULL;
+
 	QLA_VHA_MARK_BUSY(vha, bail);
 	if (bail)
 		return NULL;
-- 
2.26.0


  parent reply	other threads:[~2020-04-21 20:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-21 20:46 [PATCH v4 0/2] scsi: qla2xxx: fixes for driver unloading mwilck
2020-04-21 20:46 ` [PATCH v4 1/2] scsi: qla2xxx: set UNLOADING before waiting for session deletion mwilck
2020-04-21 21:18   ` himanshu.madhani
2020-04-21 20:46 ` mwilck [this message]
2020-04-21 21:18   ` [PATCH v4 2/2] scsi: qla2xxx: check UNLOADING before posting async work himanshu.madhani
2020-04-21 21:25 ` [EXT] [PATCH v4 0/2] scsi: qla2xxx: fixes for driver unloading Arun Easi
2020-04-22  3:54 ` 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=20200421204621.19228-3-mwilck@suse.com \
    --to=mwilck@suse.com \
    --cc=Bart.VanAssche@sandisk.com \
    --cc=aeasi@marvell.com \
    --cc=dwagner@suse.de \
    --cc=himanshu.madhani@oracle.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=qutran@marvell.com \
    --cc=r.bolshakov@yadro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.