From: Martin Wilck <mwilck@xxxxxxxx> 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@xxxxxxxx> --- 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..eb25cf5 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -4933,6 +4933,9 @@ int qla2x00_post_async_##name##_work( \ { \ struct qla_work_evt *e; \ \ + if (test_bit(UNLOADING, &vha->dpc_flags)) \ + return QLA_FUNCTION_FAILED; \ + \ e = qla2x00_alloc_work(vha, type); \ if (!e) \ return QLA_FUNCTION_FAILED; \ -- 2.25.1