From patchwork Fri Apr 21 21:26:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 9693759 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 C2D4060328 for ; Fri, 21 Apr 2017 21:27:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B39AE2846A for ; Fri, 21 Apr 2017 21:27:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A84C92866E; Fri, 21 Apr 2017 21:27:03 +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,DKIM_SIGNED, DKIM_VALID,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 08EC228678 for ; Fri, 21 Apr 2017 21:27:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422906AbdDUV1C (ORCPT ); Fri, 21 Apr 2017 17:27:02 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:50048 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422888AbdDUV05 (ORCPT ); Fri, 21 Apr 2017 17:26:57 -0400 X-IronPort-AV: E=Sophos;i="5.37,231,1488816000"; d="scan'208";a="12881818" Received: from mail-dm3nam03lp0021.outbound.protection.outlook.com (HELO NAM03-DM3-obe.outbound.protection.outlook.com) ([207.46.163.21]) by ob1.hgst.iphmx.com with ESMTP; 22 Apr 2017 05:26:48 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Ne3zDLGDXe3YTO9pJSgOmimdC7cZ4lYAsAWZ8c0I5gk=; b=aa0rv3X8b3mslk9SF85wgs9xYeitbkEZtN5KOnOiO8PIkrZ4Uz/CXhv/9Im3fnJJo4MsfUnnKsqsK4QZHR3VPHPJZyeKJZh62Z2Vi3ZDAy056C989UPYFJ2ChOZ447cDkOiEAktUgopBL26V3AIvHsztHeDMHK8ATra/3yarmrs= Received: from CO2PR04CA0112.namprd04.prod.outlook.com (10.165.95.14) by BN1PR04MB407.namprd04.prod.outlook.com (10.141.60.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.10; Fri, 21 Apr 2017 21:26:43 +0000 Received: from CO1NAM04FT046.eop-NAM04.prod.protection.outlook.com (2a01:111:f400:7e4d::201) by CO2PR04CA0112.outlook.office365.com (2603:10b6:104:7::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1047.13 via Frontend Transport; Fri, 21 Apr 2017 21:26:43 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.225) smtp.mailfrom=sandisk.com; oracle.com; dkim=none (message not signed) header.d=none;oracle.com; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.225 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.225; helo=milsmgep14.sandisk.com; Received: from milsmgep14.sandisk.com (63.163.107.225) by CO1NAM04FT046.mail.protection.outlook.com (10.152.91.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.1047.9 via Frontend Transport; Fri, 21 Apr 2017 21:26:42 +0000 Received: from MILHUBIP04.sdcorp.global.sandisk.com (Unknown_Domain [10.201.67.162]) (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by (Symantec Messaging Gateway) with SMTP id 93.9E.19026.1197AF85; Fri, 21 Apr 2017 14:26:41 -0700 (PDT) Received: from milsmgip12.sandisk.com (10.177.8.100) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.319.2; Fri, 21 Apr 2017 14:26:40 -0700 X-AuditID: 0ac94371-41ba798000004a52-59-58fa7911bb47 Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id 4E.14.18148.F097AF85; Fri, 21 Apr 2017 14:26:39 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , James Bottomley CC: , Bart Van Assche , Max Gurtovoy , "Hannes Reinecke" , Song Liu Subject: [PATCH v4 4/4] Avoid that __scsi_remove_device() hangs Date: Fri, 21 Apr 2017 14:26:36 -0700 Message-ID: <20170421212636.14376-5-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170421212636.14376-1-bart.vanassche@sandisk.com> References: <20170421212636.14376-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJLMWRmVeSWpSXmKPExsXCddJ5ka5g5a8Ig9mLrSz2LJrEZLGxn8Oi +/oONovlx/8xWZx+dIDd4ufhM8wObB4Tm9+xe0ybdIrN49n0w0weH5/eYvHYfLra4/MmuQC2 KC6blNSczLLUIn27BK6MX1fvMhecEqy4/+EPawNjH38XIyeHhICJROf6v8xdjFwcQgJLmSSa 1lxnAkkICexglFjbUg9TtHfXDXaIoo2MEksOtLCBJNgEjCS+vZ/JAmKLCBRKXNrWwQhSxCyw jVFiz6wOZpCEsIC9xMVdh8EaWARUJZrfLQSL8wLFz97fzw6xQV7i7JadYHFOAQeJl4snMENc YS8x40UTE8hQCYF5rBLvp1xhh2gWlDg58wnYZmYBCYmDL15ANahLnFwyn2kCo9AsJGWzkJQt YGRaxSiWm5lTnJueWmBoolecmJeSWZytl5yfu4kREgGFOxhf3/Y+xCjAwajEw7uC5VeEEGti WXFl7iFGCQ5mJRHeE6VAId6UxMqq1KL8+KLSnNTiQ4zSHCxK4rxZslMjhATSE0tSs1NTC1KL YLJMHJxSDYxzgnLXp+1fWDhDd+6yfKV1p1Xv3fDMVZT09318qXldWJDULA0DuUDDbZz7VS1m FaxXjzEKfXPnpO6zxfWPeP9/1hVwjZsc927ShcnLtjSd+8XQwBfJfapHTXGDwNWgyfznokx7 xe3W5d16azzf+WyN0l+ueWpHoudHebRf4TgsIvmO/b7j3XVKLMUZiYZazEXFiQBLw206fAIA AA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrJJMWRmVeSWpSXmKPExsXCtZGTTZe/8leEQc9+XYuDP9sYLfYsmsRk sbGfw6L7+g42i+XH/zFZnH50gN3i5+EzzA7sHhOb37F7TJt0is3j2fTDTB4fn95i8Zi25jyT x+bT1R6fN8kFsEdx2aSk5mSWpRbp2yVwZfy6epe54JRgxf0Pf1gbGPv4uxg5OSQETCT27rrB 3sXIxSEksJ5RomnfOxaQBJuAkcS39zPBbBGBQon7p0+zgRQxC+xglLh6/QMbSEJYwF7i4q7D YDaLgKpE87uFzCA2L1D846YnbBAb5CXObtkJFucUcJB4uXgCmC0EVDPjRRPTBEbuBYwMqxjF cjNzinPTMwsMjfSKE/NSMouz9ZLzczcxQgInagfj9YnmhxiZODilGhh3NH33UPl04NOuLS5f hU6xtzU4Cplw2ffmB8/glskMWPS9KqXk5i7Z9u1ac15n9Dss265YkOPNPnVN0fkI44e70/oX cTCxGOwUyGEtDb4sIvRlTrPeK5UVV12ffm6fLbLg5QbGeQazP82RKQrvN4x6zVJo+/MBv9tZ o9pvNblvvts4+edJH1BiKc5INNRiLipOBAB9xJ6EzAEAAA== MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:63.163.107.225; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(39840400002)(39400400002)(39410400002)(39850400002)(39860400002)(39450400003)(2980300002)(438002)(189002)(199003)(9170700003)(356003)(4326008)(5660300001)(81166006)(6666003)(2950100002)(77096006)(50986999)(53936002)(1076002)(5003940100001)(33646002)(305945005)(47776003)(76176999)(38730400002)(8676002)(189998001)(8936002)(36756003)(2906002)(106466001)(48376002)(50226002)(54906002)(86362001); DIR:OUT; SFP:1102; SCL:1; SRVR:BN1PR04MB407; H:milsmgep14.sandisk.com; FPR:; SPF:Pass; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM04FT046; 1:ui7tjeLKIz6/Fj4okmJ6ClxPF61M5wzxjEgBU0AhfhUPS+qDbmoXXn/QrT7834uXYWn8KkI+FOVCNSP+4jDhlhKYXzpXQVVoqJFsgOnvTdKlSNINzFHDudUT88rbEhhGujkKKkREBTNHTY5BI8yaGpMHNuATydOowMvt2bgSby6s1mjDI+fl/J2ajado0+Bu7feqgNoUkhk+attrF6QiAn99Jp68Qhw7AZdrDLM5D4egzM5gOuzPjR9aj4cIJJFDQyKiSb0AjgLGtiqsUBh8DYF46hS1fSVj6NkOv3f+T1XEQYxh8ToDlx1FpyXi/OuyM0INileKjR9PpKTxcn3YqkwbfSBma8wUxqWjZvtShBuQOnIMOcmvS/gJudORBEqutcJfblAjpWWK4KBeVFXqOXWQWSF0Vy1FnLdtw+IZeK93Tx4a6vOW7By3ga+nqkDjwen8Ltf76eNgpFByTOxpTVnoKft+e+cvOFEv5U2iZX4scqpbKqjU2nvrshqMmxhvUl1PR1hnwBEjmc+0Jd8J2g== X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c95f646d-81f4-4762-cd29-08d488fd1b39 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002)(2017030254075)(201703131423075)(201703031133081); SRVR:BN1PR04MB407; X-Microsoft-Exchange-Diagnostics: 1; BN1PR04MB407; 3:Bc+PIBKB4MnRIPsVBxzhnHgvgnsbD2aUVel9B95wBkS2vugux3XjOahsSRujX+xo8DTkBc8izkhnw2EUhi4FqB7NyopVoOvU2OJdKaYdgrKuUKuufiNczz7o69r55gD27rI3/JfhPoU5fOjfB3iTWTWgKZS/W6bl/r8CQ6QSmkZMvzs4BFlMDLO2MmzYYK8SJC/7pzPgbV1e4dqftujExHzJ65I5bgNcAhyUNQTXNlVLQK8hjiAVgFe7YidbyTYe+glTv/DtUxrou+LkFbQND0KnQfu0lykO93kC+FSza31hvLYU++TvgoyTO/IUvLKdXDGLgP5kbW7yAkdpSlr6zbF51WI4K6VDHPMMeA16g8wc/xDsK8Kf1ucdCTNH4+VugTZFO6xl6pFdiKeVVgMPhSWxGWwELBLCCVNVLLqhz1MahP7vSVQkKlOeVxNIcfDujfVW7uOFQw44USCYFoUPaIWaW0f6gR6OEpl3oKmXItZppPAlGdI7LTL1frapIUpR X-Microsoft-Exchange-Diagnostics: 1; BN1PR04MB407; 25:/L54KXNZ5uTWu3wKCQ/LEOZLmQSc8VQbyW+q4JW95eSfBilI7j/UV8oBDF8DpD5dEfUGhX4vStT6uOTR3x0nQJmTalRTuLplNgKSZnlUNQKTiEdF1m0zo1CTOyhbqqOoGtvW94OtJmJ12A3FKkFO803jOY2YstNSXs5/5zaYKqAiZOUMlaXufrOl2M4vyzjUIprU9fZeQlW9QCbDSbMWzBSyfTfyF8DB9aBTfOO4biXM4XIe33tlLDA5wz6lq2+N6OK4APnfhM4Fxfxgy+mLwg3Fix00Zyb2Ac6uJNG47raUIN2wd7MdlgzN7mFtxwhJhCSstyabEdvPMkzbZWJoANEduENn7lPP1mQO5kXkEM+AWeEvnuxO2OzTaoukTbo3PAiId81vk6JUDOcPE0iYjCoYHnihT9Or+aQo+9lXdau2/P/tn9aEDe4LRIJGS3jeZ3F+ih1hR+ubHJil39T4dA==; 31:i7Lgbmop8N6AZYRMLHjQ6SoO9z5KfkS4wc+j2EYnkVs6duxEaEhavpikTKxQqqLUbeUyKWfWP9Vl8Vl6LoIERBCAluOfxkshkjWL79lxAGl/hDp6rQxH4OkT/nZvLHOqG1+hRSGcsSQg+QLgSWmO9Wytgvtv/LBUB7tDKmU+DX1icGJG7sY3O0g6rLLo7vb4M2m2yKq+BZrbAsbp9jLFdFN30AvmcbxBmv278e7NKC/KdGwYq09YzC9mBiZ3FTJTasQuCK/+tc0FInheaUUgUD1FgUWuT8TBvrVuPL+ruZc= WDCIPOUTBOUND: EOP-TRUE X-Microsoft-Exchange-Diagnostics: 1; BN1PR04MB407; 20:IOvvueHQ8YJHHBBucG/wSJagNXVuFJgjqRuGxAJJWcj+nGIQUMbYNLD92Fzddg16c62WUaCH7QflpW0qtLT+yUhuzqMlHKFzQnQxlq5OLsyZDUoEPaLioxSQ04YGgJ+lBpcVp6UNaZZNIqtj3Yz2GoIXdirezFp+91ycErwB4Bs3gDcKu3cg/nikBoDL0YztE+dJZoiYSgQ60oHp+GtU/jv7XbiGeRGsTK3elLwVgGYALBaJz1zeNAZBtFYuwboMzs+ymG/hwmvfCHpP+YdmDf+ZPR+skVGA1+rbBYRv0/13Ab8HMzeXVeVfZT0lzs20pQPHVLIUDd6d+GQEhCAzQIsMiRsl+akTUtphEeCwryJqX9n0hX5p8e1YhTPDZF/MQUnMpkYPoTD+v4nLx4dTy+Fvm/1fMuvXiNJCrZSndf0nx9nWT9pwOXSlqkvJydIi8ZI2qEFIROMYCDBH8l9oWZhmygRhOwbgRgt/QAcooc6bsmH6ytfvL6EqiHC15Scw X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(67672495146484)(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(13016025)(13018025)(3002001)(10201501046)(93006095)(93004095)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(20161123560025)(20161123555025)(20161123562025)(20161123564025)(6072148); SRVR:BN1PR04MB407; BCL:0; PCL:0; RULEID:; SRVR:BN1PR04MB407; X-Microsoft-Exchange-Diagnostics: 1; BN1PR04MB407; 4:OoKbNdg0IlMQ1sJJk6UfEo3K1UR8LivXiNAraE3WE1bG4oymiOmpUMrUZhQb9J1aKW+fT7Vv+uaGLaJScUQUbBscChiB5gRAZ+OrHxsDWcwz6HWynlWXLRpZ9qjPscffZ0GkxXpIdUUDMK61nKl+iNik5vwgWxQ1zKlTCOV5fBCnftG7uzblXqzxUQT/YGaFtkYaZuPfZSxj4PSgYGQjG+NsjkPJpGcWLa+2qzwAF0ZP7pqePZhna2wDD+hW18gR8emXhkEDbBlR5ZVw/01mCPfGBTsbHhVBS/5J+fApFbyTILHjS06xUIjEcT0zZCzLMkSbKxHFesXQ1LyvBPffMedRzSBhMg/U+4SCjDnrqaEaY9gfrjU2wnSUGhR/A+xIR8c+T9mdOKkUZHvjC1HQ8QRm20L+EdokQm1VSuxTO0eMZkWccpoZlUdFgJHDBpxZM0UxyPTQ1a2gtv8tcEPuZ2VCW52tsPOsMTDwuIM0NNC6tgvN7VFWaMybrfFGJhm+hn6SERJBwPO5CuNckg6PTlFJGuCvb2whiwltoUOCRKwv5nBqXFtuBjw0eJ01SzcVvicWOLi7b4wpcA3WCTg9qi2nfc8b2VVS1Du9ZiblQ3pn1q5XI4kYoUITdo0N2bjf4JWJwC337ds4vR/WqE2y1jkhoWOP1GkOFgcY5dIWRsDLEnC5I2c0eOJdMW9VIAGCNO5E11fUrxw2XqQcL+cYPOgDChlugA7V4RxiT8iroA2s4G7VuTYsfmZFq5sLAp7bBLpjVY0Qsegwn/yoz/vnXjZ2Y/KW5n46vUn+QL2Ai7gp2Kb0kiv/huUu8IDEjirpV84uMWTbPyoFiSDY91TFkxY9FBiDHlRiy956UrS0Q5E= X-Forefront-PRVS: 02843AA9E0 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN1PR04MB407; 23:h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microsoft-Exchange-Diagnostics: 1; BN1PR04MB407; 7:j1BrPWU3cZK+lHWZw+NiUNzqETn6y90ahOgsBKmlrGPcm9PsiC/sCYeeuqANV7j25N/hoKLdIVd4Bcd03nEluoTJrBCwCVs84pzSkz1Au8lxmEGb6cqwkZei9Rgrvc/udmT+GmrnwXdgZs6QzKxySFLefj8MOtbY8iadH/5yWnhzIKWv2I5CMNNSybyRRpLAtnjkQSiUEt+S556B0+gEWPyZLcWjKBiCzCG5kNxsQYZNUqgDc4+T9AVx2xXHXCv0VOhJb+SAXv+lGqQdia+Q40V9nFbf2Vr7hVAKZqZApwPPo9H1fO4FTl/SFTmXbVaWOuSXdDBHFqJcen6TZmmYBw==; 20:4CcF7AwTwI2hfL+LbSaljCT/rRd6xINNQAf3YBGoNBozWJpftXjdSdd2/My6uR+NQN1KRQ2hAO0nwe1RXFd8DNvjxv5QLzFzK6qF/gvqCZDIKsReg6//w+QkiFmSN0pQmyikDAzDvUJcBZxTXDdHwxGeADgO0z1HpH+22QPgvRk= X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Apr 2017 21:26:42.7208 (UTC) X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=b61c8803-16f3-4c35-9b17-6f65f441df86; Ip=[63.163.107.225]; Helo=[milsmgep14.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1PR04MB407 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 Since scsi_target_unblock() uses starget_for_each_device(), since starget_for_each_device() uses scsi_device_get(), since scsi_device_get() fails after unloading of the LLD kernel module has been started scsi_target_unblock() may skip devices that were affected by scsi_target_block(). Ensure that __scsi_remove_device() does not hang for blocked SCSI devices. This patch avoids that unloading the ib_srp kernel module can trigger the following hang: Call Trace: schedule+0x35/0x80 schedule_timeout+0x237/0x2d0 io_schedule_timeout+0xa6/0x110 wait_for_completion_io+0xa3/0x110 blk_execute_rq+0xdf/0x120 scsi_execute+0xce/0x150 [scsi_mod] scsi_execute_req_flags+0x8f/0xf0 [scsi_mod] sd_sync_cache+0xa9/0x190 [sd_mod] sd_shutdown+0x6a/0x100 [sd_mod] sd_remove+0x64/0xc0 [sd_mod] __device_release_driver+0x8d/0x120 device_release_driver+0x1e/0x30 bus_remove_device+0xf9/0x170 device_del+0x127/0x240 __scsi_remove_device+0xc1/0xd0 [scsi_mod] scsi_forget_host+0x57/0x60 [scsi_mod] scsi_remove_host+0x72/0x110 [scsi_mod] srp_remove_work+0x8b/0x200 [ib_srp] Reported-by: Israel Rukshin Signed-off-by: Bart Van Assche Cc: Max Gurtovoy Cc: Hannes Reinecke Cc: Song Liu --- drivers/scsi/scsi_sysfs.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index 82dfe07b1d47..e090c35ba6ee 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c @@ -1299,6 +1299,15 @@ void __scsi_remove_device(struct scsi_device *sdev) * device. */ scsi_device_set_state(sdev, SDEV_DEL); + /* + * Since scsi_target_unblock() is a no-op after unloading of the SCSI + * LLD has started, explicitly restart the queue. Do this after the + * device state has been changed into SDEV_DEL because + * scsi_prep_state_check() returns BLKPREP_KILL for the SDEV_DEL state + * Do this before calling blk_cleanup_queue() to avoid that that + * function encounters a stopped queue. + */ + scsi_start_queue(sdev); blk_cleanup_queue(sdev->request_queue); cancel_work_sync(&sdev->requeue_work);