Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1108950imm; Wed, 1 Aug 2018 10:19:20 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfSLvATJB56EheWD8lcWpW4QDVLnfHM3rTz6Pe2NlIZn31xxliXRxhrCPk7Ak6ZXKyQoYqO X-Received: by 2002:a63:6345:: with SMTP id x66-v6mr25740602pgb.43.1533143960802; Wed, 01 Aug 2018 10:19:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533143960; cv=none; d=google.com; s=arc-20160816; b=eb7i4U0CCAzOGSqgS4nXFTZCHveT6bxKLuitsehfiY2r9tvFc/1egGTdflRDskdlqp 728ZnMC5zcRcOr+KRfNfZBfJjFcvpD571gxMS6H1xo/xhS04qymql3XuJPy7PzFJj7FV jH9Oa2jIbPBi8wHmfg/L8w99SfuIhWjkopplyVgeO97UrE8FhK/8PWGrQABT7LHaXdyc EENmv/XygkRZF5V7iETaxfZU2rjYYQWqKvCXwxnDyHBZCIabSFxpPiP5gAUIs+uhrCou K09Idv2kvM/W2+rLEeXunMdRYxCzOYpxBFNV4hEZk7OwoGSERlXYl8A6EWD5+cQEKqhM uysw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=wLjbxalo5PhJFjbuFrYdIgyyYGO1DuqzfpiNyxjUpTs=; b=FR8PRp8YL8XWbEqSc70u/P5fSDYVl3o8Wqrj3wGETaD7akVmstbJn8IGV4Vz7gNQIj xKURyf72bgK5K8O4F+Anfpb9FvudgsOGHq5e1vUmm0fTZWWr1XRVkrBOJ0eA4uRBGMT4 4+dUOGY+7JjDR0e5NvhWJn+apHNGzCftfS7KgcvnDOy/OUmUYzX/X4TWNYRQwV8vt8t4 VEaOCR4m8I3dxZmjeKDQ2OI1Str6whvHRRIuWtMWloVeDfpCiiUNcUXURONkfTqXmD51 15KQLT6/InujCvC6AwBBJ9Fdup2kn9dzD6MRYLsrvaAbiqvhQTdZjWAgp+y0TeZNXvTu gC4Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y6-v6si17180319pfy.140.2018.08.01.10.19.06; Wed, 01 Aug 2018 10:19:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404753AbeHATEX (ORCPT + 99 others); Wed, 1 Aug 2018 15:04:23 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46498 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403985AbeHATEW (ORCPT ); Wed, 1 Aug 2018 15:04:22 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id B9195C96; Wed, 1 Aug 2018 17:17:41 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Steffen Maier , Jens Remus , Benjamin Block , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.14 119/246] scsi: zfcp: assert that the ERP lock is held when tracing a recovery trigger Date: Wed, 1 Aug 2018 18:50:29 +0200 Message-Id: <20180801165017.425512008@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jens Remus [ Upstream commit 9e156c54ace310ce7fb1cd960e62416947f3d47c ] Otherwise iterating with list_for_each() over the adapter->erp_ready_head and adapter->erp_running_head lists can lead to an infinite loop. See commit "zfcp: fix infinite iteration on erp_ready_head list". The run-time check is only performed for debug kernels which have the kernel lock validator enabled. Following is an example of the warning that is reported, if the ERP lock is not held when calling zfcp_dbf_rec_trig(): WARNING: CPU: 0 PID: 604 at drivers/s390/scsi/zfcp_dbf.c:288 zfcp_dbf_rec_trig+0x172/0x188 Modules linked in: ... CPU: 0 PID: 604 Comm: kworker/u128:3 Not tainted 4.16.0-... #1 Hardware name: IBM 2964 N96 702 (z/VM 6.4.0) Workqueue: zfcp_q_0.0.1906 zfcp_scsi_rport_work Krnl PSW : 00000000330fdbf9 00000000367e9728 (zfcp_dbf_rec_trig+0x172/0x188) R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:3 PM:0 RI:0 EA:3 Krnl GPRS: 00000000c57a5d99 3288200000000000 0000000000000000 000000006cc82740 00000000009d09d6 0000000000000000 00000000000000ff 0000000000000000 0000000000000000 0000000000e1b5fe 000000006de01d38 0000000076130958 000000006cc82548 000000006de01a98 00000000009d09d6 000000006a6d3c80 Krnl Code: 00000000009d0ad2: eb7ff0b80004 lmg %r7,%r15,184(%r15) 00000000009d0ad8: c0f4000d7dd0 brcl 15,b80678 #00000000009d0ade: a7f40001 brc 15,9d0ae0 >00000000009d0ae2: a7f4ff7d brc 15,9d09dc 00000000009d0ae6: e340f0f00004 lg %r4,240(%r15) 00000000009d0aec: eb7ff0b80004 lmg %r7,%r15,184(%r15) 00000000009d0af2: 07f4 bcr 15,%r4 00000000009d0af4: 0707 bcr 0,%r7 Call Trace: ([<00000000009d09d6>] zfcp_dbf_rec_trig+0x66/0x188) [<00000000009dd740>] zfcp_scsi_rport_work+0x98/0x190 [<0000000000169b34>] process_one_work+0x3d4/0x6f8 [<000000000016a08a>] worker_thread+0x232/0x418 [<000000000017219e>] kthread+0x166/0x178 [<0000000000b815ea>] kernel_thread_starter+0x6/0xc [<0000000000b815e4>] kernel_thread_starter+0x0/0xc 2 locks held by kworker/u128:3/604: #0: ((wq_completion)name){+.+.}, at: [<0000000082af1024>] process_one_work+0x1dc/0x6f8 #1: ((work_completion)(&port->rport_work)){+.+.}, at: [<0000000082af1024>] process_one_work+0x1dc/0x6f8 Last Breaking-Event-Address: [<00000000009d0ade>] zfcp_dbf_rec_trig+0x16e/0x188 ---[ end trace b2f4020572e2c124 ]--- Suggested-by: Steffen Maier Signed-off-by: Jens Remus Reviewed-by: Benjamin Block Reviewed-by: Steffen Maier Signed-off-by: Steffen Maier Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/s390/scsi/zfcp_dbf.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/s390/scsi/zfcp_dbf.c +++ b/drivers/s390/scsi/zfcp_dbf.c @@ -285,6 +285,8 @@ void zfcp_dbf_rec_trig(char *tag, struct struct list_head *entry; unsigned long flags; + lockdep_assert_held(&adapter->erp_lock); + if (unlikely(!debug_level_enabled(dbf->rec, level))) return;