From patchwork Fri Jun 12 09:42:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sreekanth Reddy X-Patchwork-Id: 6597061 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7308D9F399 for ; Fri, 12 Jun 2015 09:52:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 89D1F2052D for ; Fri, 12 Jun 2015 09:52:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6821220680 for ; Fri, 12 Jun 2015 09:52:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754467AbbFLJnK (ORCPT ); Fri, 12 Jun 2015 05:43:10 -0400 Received: from mail-qk0-f173.google.com ([209.85.220.173]:35500 "EHLO mail-qk0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753417AbbFLJnF (ORCPT ); Fri, 12 Jun 2015 05:43:05 -0400 Received: by qkhq76 with SMTP id q76so14828201qkh.2 for ; Fri, 12 Jun 2015 02:43:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=avagotech.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LrwytNXNq/RYzB58Vd5w9X9MvxBUFYxYTnE/N5tf+jM=; b=trnil+y7gInYKrayOeVytDr4XyH/tvmpo3cVG8+c7rSCxj1Ln5POjc4mKAVu1rjcEF Bj5qsBj805RNGx8n20rboixVfukidP8h0pEdDkXUvrzBTqMkcxu1a7LlSFJUa9iC9lc2 urbW5W9zXPtva6QxDXgnq7zuUYNRe5/cFPCOE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=LrwytNXNq/RYzB58Vd5w9X9MvxBUFYxYTnE/N5tf+jM=; b=c95dhQFPV90kmQrJZNoWjbjEZ5FdPCBYcDXO18aFzf5BbxfwHUkkbdmRIJiDLF513D yw5beu6DtxaEukx1ScuyXK+LfSszaonbGeHb8ZiyuMTLHBD9QevQg+HtIxxnf4R6oyFs K2BHhxBJmrA9cKN3Q21aRvqda2I5b5KjM927lqqn9rGonreh2Yl5uDDHTqlS4P98C5Hd +ChexZtv6yEq+Y4IfjtLMFrvq9NfmLkK3RdaIMyNDLFBBN9CSsCpuGhaGvjtLH5HfT+U le/Ey5c3fy+JE1+8pN9qAGlnbD0vvX4+qTur9jdhgF/lSkgxi2IjFmLayR0O6WxUi4j7 +wrw== X-Gm-Message-State: ALoCoQkv7wj4ce0cSkv7m5cSa7EKvocKkmgVLTYH/a8PnsFe8k0FU42aT/Q50/So67fcXO4Vcehh X-Received: by 10.140.148.76 with SMTP id 73mr18229806qhu.62.1434102183969; Fri, 12 Jun 2015 02:43:03 -0700 (PDT) Received: from host1.lsi.com ([192.19.239.250]) by mx.google.com with ESMTPSA id 18sm1466219qgh.40.2015.06.12.02.42.59 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Jun 2015 02:43:03 -0700 (PDT) From: Sreekanth Reddy X-Google-Original-From: Sreekanth Reddy To: jejb@kernel.org, hch@infradead.org Cc: martin.petersen@oracle.com, linux-scsi@vger.kernel.org, JBottomley@Parallels.com, Sathya.Prakash@avagotech.com, linux-kernel@vger.kernel.org, Sreekanth Reddy Subject: [PATCH 03/20] [SCSI] mpt3sas: Don't block the drive when drive addition under the control of SML Date: Fri, 12 Jun 2015 15:12:15 +0530 Message-Id: <1434102153-38581-4-git-send-email-Sreekanth.Reddy@avagotech.com> X-Mailer: git-send-email 2.0.2 In-Reply-To: <1434102153-38581-1-git-send-email-Sreekanth.Reddy@avagotech.com> References: <1434102153-38581-1-git-send-email-Sreekanth.Reddy@avagotech.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP During hot-plugging of a disk(having a flaky link), the disk addition stops and any further disk addition or removal doesn't happen on that controller. This is because, when driver receives DELAY_NOT_RESPONDING event for a disk while it is undergoing addition at the SCSI Transport layer, the driver would block the I/O to that disk resulting in a deadlock. i.e the disk addition work couldn't be completed at the SCSI Transport Layer as it can't send any I/Os (such as Inquiry, Report LUNs etc) to the disk as I/Os are blocked to this drive. Also any subsequent device removal (TARGET_NOT_RESPONDING) or link update(RC_PHY_CHANGED) event couldn't be processed as they are in the queue to get processed after disk addition event. Description of Change: Don't block the drive when drive addition is under the control of SML. So that SML won't be blocked of issuing the device dicovery commands (such as Inquiry, Report LUNs etc). Signed-off-by: Sreekanth Reddy Reviewed-by: Martin K. Petersen --- drivers/scsi/mpt3sas/mpt3sas_base.h | 4 +++- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 7 +++++++ drivers/scsi/mpt3sas/mpt3sas_transport.c | 18 ++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h index 6b8d8f1..b79ad4f 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.h +++ b/drivers/scsi/mpt3sas/mpt3sas_base.h @@ -294,7 +294,8 @@ struct _internal_cmd { * @responding: used in _scsih_sas_device_mark_responding * @fast_path: fast path feature enable bit * @pfa_led_on: flag for PFA LED status - * + * @pend_sas_rphy_add: flag to check if device is in sas_rphy_add() + * addition routine. */ struct _sas_device { struct list_head list; @@ -315,6 +316,7 @@ struct _sas_device { u8 responding; u8 fast_path; u8 pfa_led_on; + u8 pend_sas_rphy_add; }; /** diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index 5a97e32..d457dba 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -2644,6 +2644,11 @@ _scsih_block_io_device(struct MPT3SAS_ADAPTER *ioc, u16 handle) { struct MPT3SAS_DEVICE *sas_device_priv_data; struct scsi_device *sdev; + struct _sas_device *sas_device; + + sas_device = _scsih_sas_device_find_by_handle(ioc, handle); + if (!sas_device) + return; shost_for_each_device(sdev, ioc->shost) { sas_device_priv_data = sdev->hostdata; @@ -2653,6 +2658,8 @@ _scsih_block_io_device(struct MPT3SAS_ADAPTER *ioc, u16 handle) continue; if (sas_device_priv_data->block) continue; + if (sas_device->pend_sas_rphy_add) + continue; sas_device_priv_data->block = 1; scsi_internal_device_block(sdev); sdev_printk(KERN_INFO, sdev, diff --git a/drivers/scsi/mpt3sas/mpt3sas_transport.c b/drivers/scsi/mpt3sas/mpt3sas_transport.c index efb98af..7a7aa68 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_transport.c +++ b/drivers/scsi/mpt3sas/mpt3sas_transport.c @@ -649,6 +649,7 @@ mpt3sas_transport_port_add(struct MPT3SAS_ADAPTER *ioc, u16 handle, unsigned long flags; struct _sas_node *sas_node; struct sas_rphy *rphy; + struct _sas_device *sas_device = NULL; int i; struct sas_port *port; @@ -731,10 +732,27 @@ mpt3sas_transport_port_add(struct MPT3SAS_ADAPTER *ioc, u16 handle, mpt3sas_port->remote_identify.device_type); rphy->identify = mpt3sas_port->remote_identify; + + if (mpt3sas_port->remote_identify.device_type == SAS_END_DEVICE) { + sas_device = mpt3sas_scsih_sas_device_find_by_sas_address(ioc, + mpt3sas_port->remote_identify.sas_address); + if (!sas_device) { + dfailprintk(ioc, printk(MPT3SAS_FMT + "failure at %s:%d/%s()!\n", + ioc->name, __FILE__, __LINE__, __func__)); + goto out_fail; + } + sas_device->pend_sas_rphy_add = 1; + } + if ((sas_rphy_add(rphy))) { pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc->name, __FILE__, __LINE__, __func__); } + + if (mpt3sas_port->remote_identify.device_type == SAS_END_DEVICE) + sas_device->pend_sas_rphy_add = 0; + if ((ioc->logging_level & MPT_DEBUG_TRANSPORT)) dev_printk(KERN_INFO, &rphy->dev, "add: handle(0x%04x), sas_addr(0x%016llx)\n",