From patchwork Fri Jan 5 13:27:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10146577 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C3D57601A1 for ; Fri, 5 Jan 2018 13:29:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B300F287D2 for ; Fri, 5 Jan 2018 13:29:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A8243287D4; Fri, 5 Jan 2018 13:29:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45EF2287D2 for ; Fri, 5 Jan 2018 13:29:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751645AbeAEN3Y (ORCPT ); Fri, 5 Jan 2018 08:29:24 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:36810 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751731AbeAEN3Y (ORCPT ); Fri, 5 Jan 2018 08:29:24 -0500 Received: by mail-pg0-f65.google.com with SMTP id j2so782119pgv.3 for ; Fri, 05 Jan 2018 05:29:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZtHApYKmMlRcrDWWkstZl+B7AsmotpSkc3x/atmewZA=; b=QSTToe5EFVy04MpyLn0BxZ4vdE3g4haiMK93Fk/h0WpMZydX1LyEZIrpeMYcE/KP1k VFSHI+wseiQMbRy7ynmnhei6tTwvsbxOJXr9piIrVtDfFBcl0y5Sijxh4PCtfZrCz1f1 eM76YEPtIpHOpzk55+ie7Z6XRTShSa3AwbI7I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZtHApYKmMlRcrDWWkstZl+B7AsmotpSkc3x/atmewZA=; b=QWoFnsINzQy4kMRQYyL5wLMc3Xcgwv/RUlXXoQYENQzwKNv4ohmFiBn6q0nKAw8gxd n0sM9w4Sae61B5MB/e5yBzAFam58VqPH8Byoph9di8JQjnnjqN9jgR1WFsWeKhTduZxf RndvO3xGBQ3glRbEZShKeSwCHRf3oHQgkhMT1jZQASzu3ZhYgRFXGefx2Mhh/EWz/mky BveccuQ00ygOZkgJ7mKJzuGyIcFxga4SgzGB1aODK04BSI+rzpCQdSiypw7EZSVc2uHP jC38skuKi/rgtYlSAhjsZNIWN9qPpZmjzaJqEp7XDeX8TQxc+VHVVbOzZi33qm8Xi1lX VrvQ== X-Gm-Message-State: AKGB3mLU9N0TdLb5rpfJnTxFve4uAgVgU2ElufRoooZJsXhY2ix63aC+ NGFW+TNtGwZ3yTtNbPUGy3uKRJsc X-Google-Smtp-Source: ACJfBos4wdUuE7j668YX7t1tArhP9YO0TVoEw9EeQWfGxjpmxbxgVFw/LJbyHDoTT28eNrZYpDydMw== X-Received: by 10.99.122.29 with SMTP id v29mr2584936pgc.243.1515158963205; Fri, 05 Jan 2018 05:29:23 -0800 (PST) Received: from dhcp-135-24-192-142.localdomain ([192.19.239.250]) by smtp.gmail.com with ESMTPSA id 68sm12588733pfx.186.2018.01.05.05.29.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Jan 2018 05:29:22 -0800 (PST) From: Shivasharan S To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, Shivasharan S Subject: [PATCH 06/14] megaraid_sas: unload flag should be set after scsi_remove_host is called Date: Fri, 5 Jan 2018 05:27:41 -0800 Message-Id: <1515158869-26693-7-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1515158869-26693-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1515158869-26693-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Issue - Driver returns DID_NO_CONNECT when unload is in progress, indicated using instance->unload flag. In case of dynamic unload of driver, this flag is set before calling scsi_remove_host(). While doing manual driver unload, user will see lots of prints for Sync Cache command with DID_NO_CONNECT status. Fix - Set the instance->unload flag after scsi_remove_host(). Allow device removal process to be completed and do not block any command before that. SCSI commands (like SYNC_CACHE) are received (as part of scsi_remove_host) by driver during unload will be submitted further down to the drives. Signed-off-by: Sumit Saxena Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas_base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 424858874d57..8a0776d6c6fa 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -6827,7 +6827,6 @@ static void megasas_detach_one(struct pci_dev *pdev) u32 pd_seq_map_sz; instance = pci_get_drvdata(pdev); - instance->unload = 1; host = instance->host; fusion = instance->ctrl_context; @@ -6838,6 +6837,7 @@ static void megasas_detach_one(struct pci_dev *pdev) if (instance->fw_crash_state != UNAVAILABLE) megasas_free_host_crash_buffer(instance); scsi_remove_host(instance->host); + instance->unload = 1; if (megasas_wait_for_adapter_operational(instance)) goto skip_firing_dcmds;