Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp9176681ybl; Fri, 17 Jan 2020 07:33:16 -0800 (PST) X-Google-Smtp-Source: APXvYqxOdLWcGuY6NHvwqPpiswwPXSiacx/xUBfUwRiXMVVtTZnO4tQA5vk4Bfnnf+Tf7jlPJZUb X-Received: by 2002:aca:f456:: with SMTP id s83mr3627197oih.12.1579275196451; Fri, 17 Jan 2020 07:33:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579275196; cv=none; d=google.com; s=arc-20160816; b=CvO4CF0hK6YbXpu8ENPl9U2ResmF8sLGP+OWceDGda6x/+PW9sIx2vLb3GL7m0P7JV v1Sq9dBcgGTWvWVuNuh+BH6xB92edleCHmyc/BQhAWaQNNi0vLzcBxAQtURjwD/XAzLO OXuHIn7bMK6ZY3/q6lXbJTlqEhrcBTukiwEl6Aqp0o4EsIChEDGaBNya4ZPmVJDFYaAy pxDIGeoO85yKhh9rhNIp3YZzOrd2jmdcmMYHl7DheyOJB+jTdg2+ngwt+tYtcDnfdP9c eJf9pIiyDdYY0yxtEHe8346ahzIxX+12EEac1YwmeYjQTpy0ZYkEQk2GW1nOiW1DFip6 o5lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=sSs36sQnxGTfCuz7UN6u9y3waBifKuK+zZ5r4rWQl60=; b=HZhCpWeUaNhHmFgErlgAVyX9Yvpxau0gXfKVDeliCNvbDj6Fr83jBzx4tCOj5h77BI IVRuZsODDIjE/8NJQVBMMZZQlMGlMvSW036DVte2GGLqbwAuXtt372iSYslPWRM4BNKP ZgjqgoSUTWJDPeprQc8JFOUQlSF1XGPc9GVCqCNkBqL/CqDj9LsKWSuBl0FxaB1yi7tw Y29cCRgm3A5ImjohihYYNFYWEVLHbuX5ILgs7Dwr3wK3nf9/GSiTuOH8iYlJbKXdv1jI ZVIGU4WxIbxN3f9eDSb9j6z9Cn4lF/sQxjpoGGrpveLgVMxe0ZhKq3sAQGPOxkJiwxU5 2LmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="GioBOV/K"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a15si14927553otq.83.2020.01.17.07.33.04; Fri, 17 Jan 2020 07:33:16 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b="GioBOV/K"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729138AbgAQPcG (ORCPT + 99 others); Fri, 17 Jan 2020 10:32:06 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:36555 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726942AbgAQPcG (ORCPT ); Fri, 17 Jan 2020 10:32:06 -0500 Received: by mail-pf1-f195.google.com with SMTP id x184so12126783pfb.3; Fri, 17 Jan 2020 07:32:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=sSs36sQnxGTfCuz7UN6u9y3waBifKuK+zZ5r4rWQl60=; b=GioBOV/KlZBgBSV1q0vQurfbNol7EjftOdrGxJkmUfI5btZ9mmT2P/voLGPlsW0wzL /nU+vc4Y/pw03lRVA/59moxmZyf1/0Nu96uR1Mt17jKEOxDx+CVkgzVrItAMa+2ewdMh A2VFTLHgXu/a0NA1QIs/acmlS3QNxJ7mGZr6xcFsZkCv9CbEShW1hWOr3vaPk6i7egKH 0LE5E/3FJT3t679mb4lIQaBqzqpKbio7Tvxh2fIbrwlLaFId386YkISWSfkNKsSGh/Fr mNabJ1YSUT9U1RVyOyIh9uCY/NZzQ0nFHzqdPTzX9YIj6AxjjDIVjfWXxCxQ1Y21SxHu fC1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=sSs36sQnxGTfCuz7UN6u9y3waBifKuK+zZ5r4rWQl60=; b=Htx4YTn7g1jXl1+1TeyK2T9FgPPCVLamELP1aZLS4Am4RBGJgiLLNMsEioljDKKNn4 v14RV4Um1uYqG0AWUKtP6S8f81qjN88UvE5oXLz2gBqvnT6NSbB8PwnnGJiborNMt4dd WwxS0LL9B3SXxM6uUPiSRvlc4h/W3t6/2m4DrQw8OaOiow28IFOEFNzS7lHYC3CCg8H/ gY1zoBSwDHOhSb7p5gpS6B0aySkTbYjggFOb+/WAN5aIvnTq6UJYIId0Rr1RI7uGYpki mc2W5UIBe4qXQrqv0INJl3k74x0qRjHGq2+6ep0dsz8a19KDPeNc/ctBS1dgBY6swu26 dosQ== X-Gm-Message-State: APjAAAXbEDLWas8CLMkZ2Zpee5NdfIWTcNf4X5swgQwwfhBWQNNdYD8T uzQW2uDgXJaJBANnaDqalNg= X-Received: by 2002:a62:e215:: with SMTP id a21mr3523890pfi.3.1579275125736; Fri, 17 Jan 2020 07:32:05 -0800 (PST) Received: from localhost.localdomain ([103.211.17.168]) by smtp.googlemail.com with ESMTPSA id d20sm7851020pjs.2.2020.01.17.07.32.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jan 2020 07:32:05 -0800 (PST) From: Amol Grover To: Hannes Reinecke , "James E.J. Bottomley" , "Martin K. Petersen" Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, Joel Fernandes , Madhuparna Bhowmik , "Paul E . McKenney" , Amol Grover Subject: [PATCH 1/2] drivers: scsi: fcoe: fcoe_ctlr: Pass lockdep expression to RCU lists Date: Fri, 17 Jan 2020 21:01:23 +0530 Message-Id: <20200117153123.2648-1-frextrite@gmail.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org lport->disc.rports and disc->rports are traversed using list_for_each_entry_rcu outside an RCU read-side critical section but under the protection of lport->disc.disc_mutex and disc->disc_mutex respectively. Hence, add corresponding lockdep expression to silence false-positive lockdep warnings, and harden RCU lists. Signed-off-by: Amol Grover --- drivers/scsi/fcoe/fcoe_ctlr.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/fcoe/fcoe_ctlr.c b/drivers/scsi/fcoe/fcoe_ctlr.c index 1791a393795d..0f59992c9cd9 100644 --- a/drivers/scsi/fcoe/fcoe_ctlr.c +++ b/drivers/scsi/fcoe/fcoe_ctlr.c @@ -2167,7 +2167,8 @@ static void fcoe_ctlr_disc_stop_locked(struct fc_lport *lport) struct fc_rport_priv *rdata; mutex_lock(&lport->disc.disc_mutex); - list_for_each_entry_rcu(rdata, &lport->disc.rports, peers) { + list_for_each_entry_rcu(rdata, &lport->disc.rports, peers, + lockdep_is_held(&lport->disc.disc_mutex)) { if (kref_get_unless_zero(&rdata->kref)) { fc_rport_logoff(rdata); kref_put(&rdata->kref, fc_rport_destroy); @@ -2703,7 +2704,8 @@ static unsigned long fcoe_ctlr_vn_age(struct fcoe_ctlr *fip) next_time = jiffies + msecs_to_jiffies(FIP_VN_BEACON_INT * 10); mutex_lock(&lport->disc.disc_mutex); - list_for_each_entry_rcu(rdata, &lport->disc.rports, peers) { + list_for_each_entry_rcu(rdata, &lport->disc.rports, peers, + lockdep_is_held(&lport->disc.disc_mutex)) { if (!kref_get_unless_zero(&rdata->kref)) continue; frport = fcoe_ctlr_rport(rdata); @@ -3061,7 +3063,8 @@ static void fcoe_ctlr_vn_disc(struct fcoe_ctlr *fip) mutex_lock(&disc->disc_mutex); callback = disc->pending ? disc->disc_callback : NULL; disc->pending = 0; - list_for_each_entry_rcu(rdata, &disc->rports, peers) { + list_for_each_entry_rcu(rdata, &disc->rports, peers, + lockdep_is_held(&disc->disc_mutex)) { if (!kref_get_unless_zero(&rdata->kref)) continue; frport = fcoe_ctlr_rport(rdata); -- 2.24.1