From patchwork Fri Jul 15 19:48:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian King X-Patchwork-Id: 9232509 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 13E1B60868 for ; Fri, 15 Jul 2016 19:48:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 07F062621F for ; Fri, 15 Jul 2016 19:48:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F0DE926D08; Fri, 15 Jul 2016 19:48:16 +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 DF82D2621F for ; Fri, 15 Jul 2016 19:48:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751669AbcGOTsP (ORCPT ); Fri, 15 Jul 2016 15:48:15 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:42181 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751352AbcGOTsO (ORCPT ); Fri, 15 Jul 2016 15:48:14 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u6FJiLTP073060 for ; Fri, 15 Jul 2016 15:48:14 -0400 Received: from e18.ny.us.ibm.com (e18.ny.us.ibm.com [129.33.205.208]) by mx0a-001b2d01.pphosted.com with ESMTP id 246kckaye0-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 15 Jul 2016 15:48:13 -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, 15 Jul 2016 15:48:12 -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, 15 Jul 2016 15:48:11 -0400 X-IBM-Helo: d01dlp03.pok.ibm.com X-IBM-MailFrom: brking@linux.vnet.ibm.com Received: from b01cxnp22034.gho.pok.ibm.com (b01cxnp22034.gho.pok.ibm.com [9.57.198.24]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id 7077EC90058; Fri, 15 Jul 2016 15:47:55 -0400 (EDT) Received: from b01ledav001.gho.pok.ibm.com (b01ledav001.gho.pok.ibm.com [9.57.199.106]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u6FJm5No63307792; Fri, 15 Jul 2016 19:48:05 GMT Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3D54328041; Fri, 15 Jul 2016 15:48:05 -0400 (EDT) Received: from localhost.localdomain (unknown [9.48.126.131]) by b01ledav001.gho.pok.ibm.com (Postfix) with ESMTP id 89BFD2803D; Fri, 15 Jul 2016 15:48:04 -0400 (EDT) Subject: [PATCH 1/1] ipr: Wait to do async scan until scsi host is initialized To: James.Bottomley@HansenPartnership.com Cc: linux-scsi@vger.kernel.org, brking@linux.vnet.ibm.com From: Brian King Date: Fri, 15 Jul 2016 14:48:03 -0500 X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16071519-0044-0000-0000-000000AA86A4 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16071519-0045-0000-0000-000004C0A8EB Message-Id: <20160715194804.89BFD2803D@b01ledav001.gho.pok.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-07-15_11:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=3 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1607150206 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 Reviewed-by: Gabriel Krisman Bertazi --- 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-07-15 14:47:13.412003811 -0500 +++ linux-2.6.git-bjking1/drivers/scsi/ipr.c 2016-07-15 14:47:13.422003757 -0500 @@ -3288,6 +3288,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; @@ -10362,6 +10367,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); @@ -10414,7 +10420,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-07-15 14:47:13.415003795 -0500 +++ linux-2.6.git-bjking1/drivers/scsi/ipr.h 2016-07-15 14:47:13.424003746 -0500 @@ -1478,6 +1478,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;