From patchwork Thu Aug 22 20:39:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Brace X-Patchwork-Id: 11110103 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 633DD14DE for ; Thu, 22 Aug 2019 20:39:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 497C322CE3 for ; Thu, 22 Aug 2019 20:39:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393301AbfHVUjf (ORCPT ); Thu, 22 Aug 2019 16:39:35 -0400 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:2883 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393297AbfHVUje (ORCPT ); Thu, 22 Aug 2019 16:39:34 -0400 Authentication-Results: esa5.microchip.iphmx.com; dkim=none (message not signed) header.i=none; spf=Pass smtp.mailfrom=don.brace@microsemi.com; spf=None smtp.helo=postmaster@smtp.microsemi.com Received-SPF: Pass (esa5.microchip.iphmx.com: domain of don.brace@microsemi.com designates 208.19.100.22 as permitted sender) identity=mailfrom; client-ip=208.19.100.22; receiver=esa5.microchip.iphmx.com; envelope-from="don.brace@microsemi.com"; x-sender="don.brace@microsemi.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:208.19.100.20 ip4:208.19.100.21 ip4:208.19.100.22 ip4:208.19.100.23 ip4:208.19.99.221 ip4:208.19.99.222 ip4:208.19.99.223 ip4:208.19.99.225 -all" Received-SPF: None (esa5.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@smtp.microsemi.com) identity=helo; client-ip=208.19.100.22; receiver=esa5.microchip.iphmx.com; envelope-from="don.brace@microsemi.com"; x-sender="postmaster@smtp.microsemi.com"; x-conformance=spf_only X-Ironport-Dmarc-Check-Result: validskip IronPort-SDR: uI1wauvpdz75OryVELsvj8cO8ayWUQ5/f7WoWu4lq5tFluoQGJJfIzeOoZ1oN6nCNXzFtiqof0 tjZ0gqAfUO+taVFatzGTZSt+bdVD6lmyP1eqCPbgyK6CwGMpgCjcBdaySSlJMW7No1U9x3g3cX xbr+vfQIX9o0EsWZDARHIiuvTfWFlfbCRrjyWn9Takg9UhDO12uQMXJ4hIJf9A6POGW3KP6OkQ O+jbWKVK916vjYLk7KU5WsuyhdTGhOJPA0f8mYFTDkaePro/lEVFhguVNbjhAE9JqofxLpJ5y8 nko= X-IronPort-AV: E=Sophos;i="5.64,418,1559545200"; d="scan'208";a="44671348" Received: from unknown (HELO smtp.microsemi.com) ([208.19.100.22]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 22 Aug 2019 13:39:35 -0700 Received: from AVMBX3.microsemi.net (10.100.34.33) by AVMBX2.microsemi.net (10.100.34.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 22 Aug 2019 13:39:33 -0700 Received: from AVMBX2.microsemi.net (10.100.34.32) by AVMBX3.microsemi.net (10.100.34.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 22 Aug 2019 13:39:32 -0700 Received: from [127.0.1.1] (10.238.32.34) by avmbx2.microsemi.net (10.100.34.32) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Thu, 22 Aug 2019 13:39:31 -0700 Subject: [PATCH 06/11] smartpqi: correct hang when deleting 32 lds From: Don Brace To: , , , , , , , , , , , CC: Date: Thu, 22 Aug 2019 15:39:31 -0500 Message-ID: <156650637172.18562.3457221616670782989.stgit@brunhilda> In-Reply-To: <156650628375.18562.9889154437665249418.stgit@brunhilda> References: <156650628375.18562.9889154437665249418.stgit@brunhilda> User-Agent: StGit/0.19 MIME-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Mahesh Rajashekhara - when each ld is deleted, a rescan event is triggered in the driver. These can stack up waiting on mutex_lock. - change to mutex_try_lock and schedule a rescan for later. Reviewed-by: Scott Benesh Reviewed-by: Kevin Barnett Signed-off-by: Mahesh Rajashekhara Signed-off-by: Don Brace --- drivers/scsi/smartpqi/smartpqi_init.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c index a6cb49b8e5d0..9801606dadfa 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -2236,18 +2236,20 @@ static void pqi_remove_all_scsi_devices(struct pqi_ctrl_info *ctrl_info) static int pqi_scan_scsi_devices(struct pqi_ctrl_info *ctrl_info) { - int rc; + int rc = 0; if (pqi_ctrl_offline(ctrl_info)) return -ENXIO; - mutex_lock(&ctrl_info->scan_mutex); - - rc = pqi_update_scsi_devices(ctrl_info); - if (rc) + if (!mutex_trylock(&ctrl_info->scan_mutex)) { pqi_schedule_rescan_worker_delayed(ctrl_info); - mutex_unlock(&ctrl_info->scan_mutex); + } else { + rc = pqi_update_scsi_devices(ctrl_info); + if (rc) + pqi_schedule_rescan_worker_delayed(ctrl_info); + mutex_unlock(&ctrl_info->scan_mutex); + } return rc; }