Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp788601ybj; Thu, 7 May 2020 07:40:40 -0700 (PDT) X-Google-Smtp-Source: APiQypLF7z1MpUyqGDaXkd09lK8In4GdvHlglle3aCJXngY6qtpEXlu/iPPh6Er1zGyQLcFRooJH X-Received: by 2002:a17:906:784c:: with SMTP id p12mr12672253ejm.346.1588862440407; Thu, 07 May 2020 07:40:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588862440; cv=none; d=google.com; s=arc-20160816; b=u4K8GcpyOo2/22Sc+sRHrBM9iw8ZEwrbGNfzIUfsC2RlFRdCJ9JrsUlankhvbxKtkV 3iftkpe80SsB0RT8JlQm2O2Y1LvEI6exzdseG8M+dy5kyhNFVl4wvk9NRcMbV+XQ7FVp ElZtJrIASjJLlrflK904F+c5eoFG8WMqrvn5avaB0x3hrRG0bg7QBNkDQEDrvnAKR8JC pFQHALj2wCpF7PchTdrv+h76IiZ9PyQXocyB+EKWXFtu6dxtRvk1kw4AletIuqf43KcW YnDGpOknhjHouh8BC4VMDg3/hsl/2ccoEu+Sgr41QEg/5Fw7wanh0jNPz72dA3lLGkqn 2JWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=14H1VcR4HAG6pQzjzMTZAFttIOBeAVCWns9Oq+vW3VE=; b=ci/8RZu1CNJrA8NtfScIMk6gj9wClabZxvbv397s0WXa1QT8n2N5nmCd0H4e3zmPvR 9aHuYdEfJ8tBs0a8xvNw4WseZrZ+hPxb3tq8XqJ4r4Hc/Jbu2mIWUUXmDqQXjbFljADb dHrGySEzlNbKFXWAtxBulU7EXtzRgXvOXyO0EgEBbxyEQhq10s95vUz6zJwP/xKn2gW9 MoOADD+wrcS0UC+xLJJGRY1KYDnCW0IfB0zdYPR5D6aCd/yy9aR/+iNrfG64eJaJuJRP ixBy1va0d3ahBTDA9PeX9vXvbpdVyjZu4sQ1N9Bsnldt2TvcUiCZoHfSWA7Pclnv8NbL kI4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ueq8VAsv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g6si3025964edv.316.2020.05.07.07.40.17; Thu, 07 May 2020 07:40:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ueq8VAsv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728296AbgEGOid (ORCPT + 99 others); Thu, 7 May 2020 10:38:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:53486 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726476AbgEGO1k (ORCPT ); Thu, 7 May 2020 10:27:40 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1C896215A4; Thu, 7 May 2020 14:27:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588861659; bh=WhwM3iTNbsmNSS6/bb0949tPxR2HU1JwzHMfmAt9BzA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ueq8VAsv+roqAxguB/gPFVMYUzmWmm2DDhM2gbqqmuUKqXcksm7tSOjMqL2a+D3yk UMfAGJgNOP3D4PE7a5/5KzI0NOaPMofkr7qvQcEWoiMgYi7fUkApM6fQkb6Qo8WBlu +zcIpkeTIL5pCcaxv5WFBukFzHJ0WC0MSM/KnT6M= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Martin Wilck , Arun Easi , Himanshu Madhani , "Martin K . Petersen" , Sasha Levin , linux-scsi@vger.kernel.org Subject: [PATCH AUTOSEL 5.6 10/50] scsi: qla2xxx: check UNLOADING before posting async work Date: Thu, 7 May 2020 10:26:46 -0400 Message-Id: <20200507142726.25751-10-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200507142726.25751-1-sashal@kernel.org> References: <20200507142726.25751-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Martin Wilck [ Upstream commit 5a263892d7d0b4fe351363f8d1a14c6a75955475 ] 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. Link: https://lore.kernel.org/r/20200421204621.19228-3-mwilck@suse.com Fixes: 45235022da99 ("scsi: qla2xxx: Fix driver unload by shutting down chip") Acked-by: Arun Easi Reviewed-by: Himanshu Madhani Signed-off-by: Martin Wilck Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- 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 4a89202115521..98908c2a096a7 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -4854,6 +4854,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.20.1