From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.3 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66408C33CA4 for ; Fri, 10 Jan 2020 12:45:17 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3C41F20838 for ; Fri, 10 Jan 2020 12:45:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="b5XsA7DT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3C41F20838 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-kernel-mentees-bounces@lists.linuxfoundation.org Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 1143886483; Fri, 10 Jan 2020 12:45:17 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WuRDKsmEnC8Q; Fri, 10 Jan 2020 12:45:16 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id A2EC085455; Fri, 10 Jan 2020 12:45:16 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 92094C1796; Fri, 10 Jan 2020 12:45:16 +0000 (UTC) Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 06139C0881 for ; Fri, 10 Jan 2020 12:45:15 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id E87F586B2A for ; Fri, 10 Jan 2020 12:45:14 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mi6FgbZgwChn for ; Fri, 10 Jan 2020 12:45:14 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 6656F86B26 for ; Fri, 10 Jan 2020 12:45:14 +0000 (UTC) Received: by mail-pl1-f196.google.com with SMTP id c23so829614plz.4 for ; Fri, 10 Jan 2020 04:45:14 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=XiQjNY1xMxvJGSxUkChVfHVoiKMHp1TNrNrHF4ZFhmk=; b=b5XsA7DThL8r6GGH8yPwhCzBc8/TOhXIH1LFctpB2xpxTiR2m72+DbZJ4RtRFyln2a R5kta/LHKYotlALlWC9m9aS4lpRaY4viIDvfvqGRFmqxLHQ0VTSriLeoZY6+dArcDqd+ 2PoXgtCFBShumyyuigvCh+HKK8Iq/Rj9X3HRq+lgU/PY3u+ulxf9UL+c0FH4QAtLMQVZ pPMkMYmcYk8nUKGWbibfOyJwXC84jGJtcztcbjlhVl2h3AzUUPirGRUux2xBRYn4uYnT /d66fzJAl+k/KVeQI0RZyWY1OvFTbbbqGUATb/IrsIfmnj8rVC8t0JJ76P4h7slQguPU aMdA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=XiQjNY1xMxvJGSxUkChVfHVoiKMHp1TNrNrHF4ZFhmk=; b=hIj6PWQTLaJt1QFiPRJLSZdQ6wTNSsBeht9ROMP7z4Evq+MExQWbC5c965zYkQSGxu cnKc09I0KSOuMP4mTevqikdyHpoZqZbqnBJY4xxJrzBQG9G2z/4BGJfJ+TA4AM93u7qH 7m55S2/AdiN5NA63HUxVBo1ZuvaZ8SwA10VYIOtdjFzjnxdbYZ6itJREDyYwo88XIUAR QqjabM3kkrf1bbUsn5/YClHtDrdcnwhuWlysScsoAi+XguKlRGXLQfOrh6Kym2lcNLhk hLtGIdWxog50LODSjExl6hNucfMGNO8U+oVb/tsQdSvWUmEqwxvehn1lo8aRbrnA6Voj 7Jow== X-Gm-Message-State: APjAAAVnUdT+APOcHDFlztyku56KjV2l8G2DwumTDyW/AlyH3T34//Iu 6sFL+5qx0xEPKJmDt6qXc38= X-Google-Smtp-Source: APXvYqxXTdVEHBTBnbbB8JYku5LMrEpUI+NVX8F4bBlQ/zEjWRWUV7IiVO3ufElg/4V2oMKi0xiB4g== X-Received: by 2002:a17:90a:3a86:: with SMTP id b6mr4553372pjc.96.1578660314074; Fri, 10 Jan 2020 04:45:14 -0800 (PST) Received: from localhost.localdomain ([103.211.17.220]) by smtp.googlemail.com with ESMTPSA id d3sm2764724pfn.113.2020.01.10.04.45.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2020 04:45:13 -0800 (PST) From: Amol Grover To: "Martin K. Petersen" Date: Fri, 10 Jan 2020 18:14:05 +0530 Message-Id: <20200110124403.27882-2-frextrite@gmail.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200110124403.27882-1-frextrite@gmail.com> References: <20200110124403.27882-1-frextrite@gmail.com> MIME-Version: 1.0 Cc: "Paul E . McKenney" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, target-devel@vger.kernel.org, Joel Fernandes , linux-kernel-mentees@lists.linuxfoundation.org Subject: [Linux-kernel-mentees] [PATCH 2/3] drivers: target: target_core_tpg: Pass lockdep expression to RCU lists X-BeenThere: linux-kernel-mentees@lists.linuxfoundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-kernel-mentees-bounces@lists.linuxfoundation.org Sender: "Linux-kernel-mentees" tpg->tpg_lun_hlist is traversed with hlist_for_each_entry_rcu outside an RCU read-side critical section but under the protection of tpg->tpg_lun_mutex. Hence, add the corresponding lockdep expression to the list traversal primitive to silence false-positive lockdep warnings, and harden RCU lists. Add macro for the corresponding lockdep expression to make the code clean and concise. Signed-off-by: Amol Grover --- drivers/target/target_core_tpg.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c index d24e0a3ba3ff..bc1c5dda81bf 100644 --- a/drivers/target/target_core_tpg.c +++ b/drivers/target/target_core_tpg.c @@ -30,6 +30,9 @@ #include "target_core_pr.h" #include "target_core_ua.h" +#define tpg_lun_mutex_held() \ + lockdep_is_held(&tpg->tpg_lun_mutex) + extern struct se_device *g_lun0_dev; /* __core_tpg_get_initiator_node_acl(): @@ -110,12 +113,12 @@ void core_tpg_add_node_to_devs( struct se_device *dev; mutex_lock(&tpg->tpg_lun_mutex); - hlist_for_each_entry_rcu(lun, &tpg->tpg_lun_hlist, link) { + hlist_for_each_entry_rcu(lun, &tpg->tpg_lun_hlist, link, + tpg_lun_mutex_held()) { if (lun_orig && lun != lun_orig) continue; - dev = rcu_dereference_check(lun->lun_se_dev, - lockdep_is_held(&tpg->tpg_lun_mutex)); + dev = rcu_dereference_check(lun->lun_se_dev, tpg_lun_mutex_held()); /* * By default in LIO-Target $FABRIC_MOD, * demo_mode_write_protect is ON, or READ_ONLY; -- 2.24.1 _______________________________________________ Linux-kernel-mentees mailing list Linux-kernel-mentees@lists.linuxfoundation.org https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees