From patchwork Fri May 22 06:11:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nicholas A. Bellinger" X-Patchwork-Id: 6461351 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6829D9F1CC for ; Fri, 22 May 2015 06:14:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 83CF12044C for ; Fri, 22 May 2015 06:14:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7E9A520434 for ; Fri, 22 May 2015 06:14:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756558AbbEVGON (ORCPT ); Fri, 22 May 2015 02:14:13 -0400 Received: from mail-oi0-f47.google.com ([209.85.218.47]:35753 "EHLO mail-oi0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756513AbbEVGOD (ORCPT ); Fri, 22 May 2015 02:14:03 -0400 Received: by oihd6 with SMTP id d6so6851260oih.2 for ; Thu, 21 May 2015 23:14:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZsGIHmpqNPD0o9v72K9K0oWn16J3rNbMa17HnTH0MYk=; b=YkDHCGyDwucoMYtnTwk6EljG4Gu3aCOJy6n/dJ5mb6no3BrLeWmuTWc3l+JxlzkLCi bhgDy4XYCss7yVCF+IzUOPDX5bF6CICMdfFZ7gmH4dV2WytFlQuB57WxUTMSisEgjPtb rFILMNTJAgry2iUK1r00mKUd8JXsIe5YZxJ/dGJQUg4bBIUT6mOqjtAhQtJMpk4Eo1kt F64ddiy8rS6wxgN1m8wx5SWa31Z5q+UDM8+QYgEyWcdPBlWOGwGcOcLhfGiMhCp9/dgD hxemK8SjlDLpkzx8lLaIR7grjkDeSLY2QfPphZ+QyFOn/thWqer6fDyKCH38m8CoF1e7 DfhQ== X-Gm-Message-State: ALoCoQke4aWvps93W3qchx2cRZJwcAB9n8oV8/nRWaVlhavI7EEX1zn+MSul+rUJvmBGBLc4sSiJ X-Received: by 10.202.195.211 with SMTP id t202mr4922807oif.117.1432275242580; Thu, 21 May 2015 23:14:02 -0700 (PDT) Received: from localhost.localdomain (mail.linux-iscsi.org. [67.23.28.174]) by mx.google.com with ESMTPSA id xs4sm773414obc.12.2015.05.21.23.14.01 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 21 May 2015 23:14:02 -0700 (PDT) From: "Nicholas A. Bellinger" To: target-devel Cc: linux-scsi , linux-kernel , Hannes Reinecke , Christoph Hellwig , Sagi Grimberg , "Paul E. McKenney" , Nicholas Bellinger Subject: [PATCH-v2 9/9] target: Only reset specific dynamic entries during lun_group creation Date: Fri, 22 May 2015 06:11:11 +0000 Message-Id: <1432275071-28882-10-git-send-email-nab@daterainc.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1432275071-28882-1-git-send-email-nab@daterainc.com> References: <1432275071-28882-1-git-send-email-nab@daterainc.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Nicholas Bellinger This patch changes core_tpg_add_node_to_devs() to avoid unnecessarly resetting every se_dev_entry in se_node_acl->tpg_lun_hlist when the operation is driven by an explicit configfs se_lun->lun_group creation via core_dev_add_lun() to only update a single se_lun. Otherwise for the second core_tpg_check_initiator_node_acl() case, go ahead and continue to scan the full set of currently active se_lun in se_portal_group->tpg_lun_hlist. Cc: Hannes Reinecke Cc: Christoph Hellwig Cc: Sagi Grimberg Signed-off-by: Nicholas Bellinger --- drivers/target/target_core_device.c | 2 +- drivers/target/target_core_internal.h | 3 ++- drivers/target/target_core_tpg.c | 7 +++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 7674c8f..c80a7a8 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c @@ -1186,7 +1186,7 @@ int core_dev_add_lun( if (acl->dynamic_node_acl && (!tpg->se_tpg_tfo->tpg_check_demo_mode_login_only || !tpg->se_tpg_tfo->tpg_check_demo_mode_login_only(tpg))) { - core_tpg_add_node_to_devs(acl, tpg); + core_tpg_add_node_to_devs(acl, tpg, lun); } } mutex_unlock(&tpg->acl_node_mutex); diff --git a/drivers/target/target_core_internal.h b/drivers/target/target_core_internal.h index 2c160ce..ce80ca7 100644 --- a/drivers/target/target_core_internal.h +++ b/drivers/target/target_core_internal.h @@ -64,7 +64,8 @@ extern struct se_device *g_lun0_dev; struct se_node_acl *__core_tpg_get_initiator_node_acl(struct se_portal_group *tpg, const char *); -void core_tpg_add_node_to_devs(struct se_node_acl *, struct se_portal_group *); +void core_tpg_add_node_to_devs(struct se_node_acl *, struct se_portal_group *, + struct se_lun *); void core_tpg_wait_for_nacl_pr_ref(struct se_node_acl *); struct se_lun *core_tpg_alloc_lun(struct se_portal_group *, u32); int core_tpg_add_lun(struct se_portal_group *, struct se_lun *, diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c index 73c25bd..f66c208 100644 --- a/drivers/target/target_core_tpg.c +++ b/drivers/target/target_core_tpg.c @@ -89,7 +89,8 @@ EXPORT_SYMBOL(core_tpg_get_initiator_node_acl); */ void core_tpg_add_node_to_devs( struct se_node_acl *acl, - struct se_portal_group *tpg) + struct se_portal_group *tpg, + struct se_lun *lun_orig) { u32 lun_access = 0; struct se_lun *lun; @@ -99,6 +100,8 @@ void core_tpg_add_node_to_devs( hlist_for_each_entry_rcu(lun, &tpg->tpg_lun_hlist, link) { if (lun->lun_status != TRANSPORT_LUN_STATUS_ACTIVE) continue; + if (lun_orig && lun != lun_orig) + continue; dev = lun->lun_se_dev; /* @@ -238,7 +241,7 @@ struct se_node_acl *core_tpg_check_initiator_node_acl( */ if ((tpg->se_tpg_tfo->tpg_check_demo_mode_login_only == NULL) || (tpg->se_tpg_tfo->tpg_check_demo_mode_login_only(tpg) != 1)) - core_tpg_add_node_to_devs(acl, tpg); + core_tpg_add_node_to_devs(acl, tpg, NULL); target_add_node_acl(acl); return acl;