From patchwork Sun Sep 18 02:36:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Zmx5aW5ncGVuZyjlva3mtakp?= X-Patchwork-Id: 607287 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6687FECAAA1 for ; Sun, 18 Sep 2022 02:46:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229533AbiIRCqW (ORCPT ); Sat, 17 Sep 2022 22:46:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229447AbiIRCqV (ORCPT ); Sat, 17 Sep 2022 22:46:21 -0400 X-Greylist: delayed 600 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sat, 17 Sep 2022 19:46:06 PDT Received: from mail11.tencent.com (mail11.tencent.com [14.18.178.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F267A18E3F for ; Sat, 17 Sep 2022 19:46:06 -0700 (PDT) Received: from EX-SZ018.tencent.com (unknown [10.28.6.39]) by mail11.tencent.com (Postfix) with ESMTP id D3FEEFC026; Sun, 18 Sep 2022 10:36:03 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tencent.com; s=s202002; t=1663468563; bh=vGc8Y0cJBcko2hULJLRwbCZMSdAWWwq3LQU2D88qfbE=; h=From:To:CC:Subject:Date; b=nfruLQ5yIkOY+Z06yhRyMdtMRy5yYM5EBHC5VjlqGFnf8/qisD9dR6c664HnbFy4O iCW4P8zohdQSbM5qgFOZ+ii6+5bmLfyiw1opy2K4C+aXKsKQIcO7+Pmp9ADLAGd+Qp KO3chC0n4cNoOLopKfqum+HrQ8KKxJkOJDQZ1IPo= Received: from EX-SZ051.tencent.com (10.28.6.106) by EX-SZ018.tencent.com (10.28.6.39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Sun, 18 Sep 2022 10:36:03 +0800 Received: from EX-SZ049.tencent.com (10.28.6.102) by EX-SZ051.tencent.com (10.28.6.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Sun, 18 Sep 2022 10:36:03 +0800 Received: from EX-SZ049.tencent.com ([fe80::e0be:89c3:ec1:bef7]) by EX-SZ049.tencent.com ([fe80::e0be:89c3:ec1:bef7%8]) with mapi id 15.01.2242.008; Sun, 18 Sep 2022 10:36:03 +0800 From: =?utf-8?b?Zmx5aW5ncGVuZyjlva3mtakp?= To: "jejb@linux.ibm.com" , "martin.petersen@oracle.com" CC: "linux-scsi@vger.kernel.org" Subject: [PATCH ] scsi/ipr: keep the order of locks Thread-Topic: [PATCH ] scsi/ipr: keep the order of locks Thread-Index: AQHYywdlY7tfNpRgx0+f69LISljf4g== Date: Sun, 18 Sep 2022 02:36:03 +0000 Message-ID: <2DD37C22-98B2-45B9-81F4-4DED4643CDC5@tencent.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [9.218.225.3] Content-ID: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org ipr_ata_post_internal: acquire host_lock acquire hrrq->_lock ipr_device_reset ipr_send_blocking_cmd release host_lock acquire host_lock release hrrq->_lock release host_lock As shown above, there are two lock acquisition order changes. At the same time, when ipr_device_reset is executed, the lock hrrq->_lock does not need to be held. Signed-off-by: Peng Hao --- drivers/scsi/ipr.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.27.0 diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 9d01a3e3c26a..6ca987dda397 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c @@ -6837,7 +6837,9 @@ static void ipr_ata_post_internal(struct ata_queued_cmd *qc) spin_lock(&hrrq->_lock); list_for_each_entry(ipr_cmd, &hrrq->hrrq_pending_q, queue) { if (ipr_cmd->qc == qc) { + spin_unlock(&hrrq->_lock); ipr_device_reset(ioa_cfg, sata_port->res); + spin_lock(&hrrq->_lock); break; } }