From patchwork Fri Jun 10 21:36:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian King X-Patchwork-Id: 9170485 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 52EA1607D9 for ; Fri, 10 Jun 2016 21:36:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45877281AA for ; Fri, 10 Jun 2016 21:36:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A3472833F; Fri, 10 Jun 2016 21:36:53 +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=-6.9 required=2.0 tests=BAYES_00,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 E0921281AA for ; Fri, 10 Jun 2016 21:36:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752017AbcFJVgw (ORCPT ); Fri, 10 Jun 2016 17:36:52 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:45225 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751382AbcFJVgv (ORCPT ); Fri, 10 Jun 2016 17:36:51 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u5ALXfcJ043850 for ; Fri, 10 Jun 2016 17:36:50 -0400 Received: from e18.ny.us.ibm.com (e18.ny.us.ibm.com [129.33.205.208]) by mx0b-001b2d01.pphosted.com with ESMTP id 23g1e5nmy3-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 10 Jun 2016 17:36:50 -0400 Received: from localhost by e18.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 10 Jun 2016 17:36:50 -0400 Received: from d01dlp03.pok.ibm.com (9.56.250.168) by e18.ny.us.ibm.com (146.89.104.205) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 10 Jun 2016 17:36:47 -0400 X-IBM-Helo: d01dlp03.pok.ibm.com X-IBM-MailFrom: brking@linux.vnet.ibm.com X-IBM-RcptTo: tj@kernel.org; linux-ide@vger.kernel.org; linux-scsi@vger.kernel.org Received: from b01cxnp22035.gho.pok.ibm.com (b01cxnp22035.gho.pok.ibm.com [9.57.198.25]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id 7DFE6C9003E; Fri, 10 Jun 2016 17:36:38 -0400 (EDT) Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u5ALak3j38535264; Fri, 10 Jun 2016 21:36:46 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 81A65AE04B; Fri, 10 Jun 2016 17:36:46 -0400 (EDT) Received: from [9.10.86.84] (unknown [9.10.86.84]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP id 51801AE03C; Fri, 10 Jun 2016 17:36:46 -0400 (EDT) Subject: [RFC] [PATCH 1/3] ipr: Wait to do async scan until scsi host is initialized To: Tejun Heo , "linux-scsi@vger.kernel.org" , linux-ide References: <57470450.3070000@linux.vnet.ibm.com> <575B3215.5070602@linux.vnet.ibm.com> From: Brian King Date: Fri, 10 Jun 2016 16:36:46 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <575B3215.5070602@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16061021-0044-0000-0000-0000005D0050 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16061021-0045-0000-0000-00000471FFDF Message-Id: <575B32EE.8080403@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-06-10_12:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1606100240 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 When performing an async scan, make sure the kthread doing scanning doesn't start before the scsi host is fully initialized. Signed-off-by: Brian King --- drivers/scsi/ipr.c | 9 +++++++++ drivers/scsi/ipr.h | 1 + 2 files changed, 10 insertions(+) diff -puN drivers/scsi/ipr.c~ipr_async_scan_fixup drivers/scsi/ipr.c --- linux-2.6.git/drivers/scsi/ipr.c~ipr_async_scan_fixup 2016-06-01 21:04:14.088698640 -0500 +++ linux-2.6.git-bjking1/drivers/scsi/ipr.c 2016-06-10 15:35:56.738201739 -0500 @@ -3287,6 +3287,11 @@ static void ipr_worker_thread(struct wor return; } + if (!ioa_cfg->scan_enabled) { + spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); + return; + } + restart: do { did_work = 0; @@ -10360,6 +10365,7 @@ static void ipr_remove(struct pci_dev *p static int ipr_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id) { struct ipr_ioa_cfg *ioa_cfg; + unsigned long flags; int rc, i; rc = ipr_probe_ioa(pdev, dev_id); @@ -10412,7 +10418,10 @@ static int ipr_probe(struct pci_dev *pde } } + spin_lock_irqsave(ioa_cfg->host->host_lock, flags); + ioa_cfg->scan_enabled = 1; schedule_work(&ioa_cfg->work_q); + spin_unlock_irqrestore(ioa_cfg->host->host_lock, flags); return 0; } diff -puN drivers/scsi/ipr.h~ipr_async_scan_fixup drivers/scsi/ipr.h --- linux-2.6.git/drivers/scsi/ipr.h~ipr_async_scan_fixup 2016-06-01 21:04:17.186678232 -0500 +++ linux-2.6.git-bjking1/drivers/scsi/ipr.h 2016-06-10 15:35:56.739201727 -0500 @@ -1475,6 +1475,7 @@ struct ipr_ioa_cfg { u8 in_ioa_bringdown:1; u8 ioa_unit_checked:1; u8 dump_taken:1; + u8 scan_enabled:1; u8 scan_done:1; u8 needs_hard_reset:1; u8 dual_raid:1;