From patchwork Fri Jan 8 07:15:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nicholas A. Bellinger" X-Patchwork-Id: 7982951 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C8E32BEEE5 for ; Fri, 8 Jan 2016 07:18:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BE1352014A for ; Fri, 8 Jan 2016 07:18:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 80DC320138 for ; Fri, 8 Jan 2016 07:18:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754141AbcAHHR6 (ORCPT ); Fri, 8 Jan 2016 02:17:58 -0500 Received: from mail-oi0-f50.google.com ([209.85.218.50]:35889 "EHLO mail-oi0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754084AbcAHHRz (ORCPT ); Fri, 8 Jan 2016 02:17:55 -0500 Received: by mail-oi0-f50.google.com with SMTP id o62so323933739oif.3 for ; Thu, 07 Jan 2016 23:17:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daterainc-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=iRBt+aSQYChFgvTtezZbykfm9C11p4GkeoM6ctg79Ak=; b=BNgDl9p9SfpwKVrpnoJb+eVtOnynNp4/jTWUkdACwmmruqKbcEbKwBxLBAL18XTSAN BG5I/xDN0hA/ekdveigkPIpL/Z8D4g1oC3ZPbH5S1BmcHn1dKFlwPhCSfZPMmh0LFsxV mgzG+/ALGtwU+yXKT7NagHDmHyiTB6wo2urOikj0Q982k5e2m4FVGb4B/8tyaR4b5dtU mafee6jQYfzJj+HdGu2LmxlG1OLTEvci2Y8YwC1h3v2MDLx8w6fBdy0DqEH8gBOrpiiK 2l/wxAoOT09+5SYnZaSSFpiFSMGZwD4AQEbOXvmaM7rjCKBbgAjNj7RqsBvOqV+WcsXC 5kvg== 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=iRBt+aSQYChFgvTtezZbykfm9C11p4GkeoM6ctg79Ak=; b=U9/xktlmy6N4BGd0lAAU1FXHrPxTdqAZg9FoVMood8OoBdy1Kc28evj0N1KHvKhjXr Hya6AVw8qugsJdeFXRx2IUdKfqGu971NoE5s7XhpRdDADj2Hk7jMlAL3s77fGupz4Kpq jpz67bcGmcg5/NvFL/nKKAN+CH4IumAbVnjURQ59z9yTN8V60+L0v7ql/EqUuT3TOEWD QZNlJt55AI7q8M/E2SeHppJ+MF1u/QtYNQPqC4rCYKI7TEOEh0Wj+PhHDmAWZZDtf9lr 7Gj/jhyNGbxmMMOz8wDJSbbtVo39R7S5cM8ozKzmIRuRh3mObOi/hynFl+Sa5iwvemFg Si6A== X-Gm-Message-State: ALoCoQkl1MFfNDuhq48HNJPOyle+tStDSwcWhVg/HusTzmVyV2Xqfdx3zymKYrcN4VcHfDaFAxpWp8drBzNJlftCKiUc6CS/IQ== X-Received: by 10.202.201.77 with SMTP id z74mr77751149oif.24.1452237475133; Thu, 07 Jan 2016 23:17:55 -0800 (PST) Received: from localhost.localdomain (mail.linux-iscsi.org. [67.23.28.174]) by smtp.gmail.com with ESMTPSA id l19sm5788137oig.27.2016.01.07.23.17.54 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 07 Jan 2016 23:17:54 -0800 (PST) From: "Nicholas A. Bellinger" To: target-devel Cc: linux-scsi , lkml , Sagi Grimberg , Christoph Hellwig , Hannes Reinecke , Andy Grover , Vasu Dev , Vu Pham , Nicholas Bellinger Subject: [PATCH 2/4] target: Remove useless set_initiator_node_queue_depth acl lookup Date: Fri, 8 Jan 2016 07:15:46 +0000 Message-Id: <1452237348-2277-3-git-send-email-nab@daterainc.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1452237348-2277-1-git-send-email-nab@daterainc.com> References: <1452237348-2277-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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 With the changes in place to obtain se_node_acl->acl_kref from within core_tpg_del_initiator_node_acl() and auditing existing users, it's clear there is no need to perform the lookup during core_tpg_set_initiator_node_queue_depth(). This is because se_node_acl->acl_group is already protecting the se_node_acl reference via configfs, and ->acl_group shutdown in core_tpg_del_initiator_node_acl() can't occur until core_tpg_set_initiator_node_queue_depth() completes. Also, remove a related pointless wrapper in iscsi-target. Cc: Sagi Grimberg Cc: Christoph Hellwig Cc: Hannes Reinecke Cc: Andy Grover Signed-off-by: Nicholas Bellinger --- drivers/target/iscsi/iscsi_target_configfs.c | 6 +++--- drivers/target/iscsi/iscsi_target_tpg.c | 10 ---------- drivers/target/iscsi/iscsi_target_tpg.h | 2 -- drivers/target/target_core_tpg.c | 23 ++++------------------- include/target/target_core_fabric.h | 2 +- 5 files changed, 8 insertions(+), 35 deletions(-) diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c index 255204c..6469321 100644 --- a/drivers/target/iscsi/iscsi_target_configfs.c +++ b/drivers/target/iscsi/iscsi_target_configfs.c @@ -726,10 +726,10 @@ static ssize_t lio_target_nacl_cmdsn_depth_store(struct config_item *item, if (iscsit_get_tpg(tpg) < 0) return -EINVAL; /* - * iscsit_tpg_set_initiator_node_queue_depth() assumes force=1 + * core_tpg_set_initiator_node_queue_depth() assumes force=1 */ - ret = iscsit_tpg_set_initiator_node_queue_depth(tpg, - config_item_name(acl_ci), cmdsn_depth, 1); + ret = core_tpg_set_initiator_node_queue_depth(se_tpg, se_nacl, + cmdsn_depth, 1); pr_debug("LIO_Target_ConfigFS: %s/%s Set CmdSN Window: %u for" "InitiatorName: %s\n", config_item_name(wwn_ci), diff --git a/drivers/target/iscsi/iscsi_target_tpg.c b/drivers/target/iscsi/iscsi_target_tpg.c index 23c95cd..0814e58 100644 --- a/drivers/target/iscsi/iscsi_target_tpg.c +++ b/drivers/target/iscsi/iscsi_target_tpg.c @@ -590,16 +590,6 @@ int iscsit_tpg_del_network_portal( return iscsit_tpg_release_np(tpg_np, tpg, np); } -int iscsit_tpg_set_initiator_node_queue_depth( - struct iscsi_portal_group *tpg, - unsigned char *initiatorname, - u32 queue_depth, - int force) -{ - return core_tpg_set_initiator_node_queue_depth(&tpg->tpg_se_tpg, - initiatorname, queue_depth, force); -} - int iscsit_ta_authentication(struct iscsi_portal_group *tpg, u32 authentication) { unsigned char buf1[256], buf2[256], *none = NULL; diff --git a/drivers/target/iscsi/iscsi_target_tpg.h b/drivers/target/iscsi/iscsi_target_tpg.h index 9db32bd..2da2119 100644 --- a/drivers/target/iscsi/iscsi_target_tpg.h +++ b/drivers/target/iscsi/iscsi_target_tpg.h @@ -26,8 +26,6 @@ extern struct iscsi_tpg_np *iscsit_tpg_add_network_portal(struct iscsi_portal_gr int); extern int iscsit_tpg_del_network_portal(struct iscsi_portal_group *, struct iscsi_tpg_np *); -extern int iscsit_tpg_set_initiator_node_queue_depth(struct iscsi_portal_group *, - unsigned char *, u32, int); extern int iscsit_ta_authentication(struct iscsi_portal_group *, u32); extern int iscsit_ta_login_timeout(struct iscsi_portal_group *, u32); extern int iscsit_ta_netif_timeout(struct iscsi_portal_group *, u32); diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c index fb77fe1..550d6f8 100644 --- a/drivers/target/target_core_tpg.c +++ b/drivers/target/target_core_tpg.c @@ -371,30 +371,18 @@ void core_tpg_del_initiator_node_acl(struct se_node_acl *acl) */ int core_tpg_set_initiator_node_queue_depth( struct se_portal_group *tpg, - unsigned char *initiatorname, + struct se_node_acl *acl, u32 queue_depth, int force) { struct se_session *sess, *init_sess = NULL; - struct se_node_acl *acl; unsigned long flags; int dynamic_acl = 0; - mutex_lock(&tpg->acl_node_mutex); - acl = __core_tpg_get_initiator_node_acl(tpg, initiatorname); - if (!acl) { - pr_err("Access Control List entry for %s Initiator" - " Node %s does not exists for TPG %hu, ignoring" - " request.\n", tpg->se_tpg_tfo->get_fabric_name(), - initiatorname, tpg->se_tpg_tfo->tpg_get_tag(tpg)); - mutex_unlock(&tpg->acl_node_mutex); - return -ENODEV; - } if (acl->dynamic_node_acl) { acl->dynamic_node_acl = 0; dynamic_acl = 1; } - mutex_unlock(&tpg->acl_node_mutex); spin_lock_irqsave(&tpg->session_lock, flags); list_for_each_entry(sess, &tpg->tpg_sess_list, sess_list) { @@ -407,13 +395,12 @@ int core_tpg_set_initiator_node_queue_depth( " operational. To forcefully change the queue" " depth and force session reinstatement" " use the \"force=1\" parameter.\n", - tpg->se_tpg_tfo->get_fabric_name(), initiatorname); + tpg->se_tpg_tfo->get_fabric_name(), + acl->initiatorname); spin_unlock_irqrestore(&tpg->session_lock, flags); - mutex_lock(&tpg->acl_node_mutex); if (dynamic_acl) acl->dynamic_node_acl = 1; - mutex_unlock(&tpg->acl_node_mutex); return -EEXIST; } /* @@ -464,13 +451,11 @@ int core_tpg_set_initiator_node_queue_depth( pr_debug("Successfully changed queue depth to: %d for Initiator" " Node: %s on %s Target Portal Group: %u\n", queue_depth, - initiatorname, tpg->se_tpg_tfo->get_fabric_name(), + acl->initiatorname, tpg->se_tpg_tfo->get_fabric_name(), tpg->se_tpg_tfo->tpg_get_tag(tpg)); - mutex_lock(&tpg->acl_node_mutex); if (dynamic_acl) acl->dynamic_node_acl = 1; - mutex_unlock(&tpg->acl_node_mutex); return 0; } diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index de21130..7f83295 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h @@ -172,7 +172,7 @@ struct se_node_acl *core_tpg_get_initiator_node_acl(struct se_portal_group *tpg, struct se_node_acl *core_tpg_check_initiator_node_acl(struct se_portal_group *, unsigned char *); int core_tpg_set_initiator_node_queue_depth(struct se_portal_group *, - unsigned char *, u32, int); + struct se_node_acl *, u32, int); int core_tpg_set_initiator_node_tag(struct se_portal_group *, struct se_node_acl *, const char *); int core_tpg_register(struct se_wwn *, struct se_portal_group *, int);