All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
To: linux-scsi <linux-scsi@vger.kernel.org>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>,
	Nicholas Bellinger <nab@linux-iscsi.org>
Subject: [PATCH 10/24] target: Release left-over demo-mode NodeACLs w/ tfo->tpg_check_demo_mode_cache()=1
Date: Sat, 29 Jan 2011 10:36:10 -0800	[thread overview]
Message-ID: <1296326184-16664-11-git-send-email-nab@linux-iscsi.org> (raw)
In-Reply-To: <1296326184-16664-1-git-send-email-nab@linux-iscsi.org>

From: Nicholas Bellinger <nab@linux-iscsi.org>

This patch adds the missing struct se_portal_groups->acl_node_list walk & release
following target_core_transport.c:transport_deregister_session() logic with
tfo->tpg_check_demo_mode_cache()=1 mode for left-over demo-mode struct se_node_acl
dynamic allocations during the final core_tpg_deregister() shutdown sequence.

As with transport_deregister_session() w/ tfo->tpg_check_demo_mode_cache()=0, it
waits for any outstanding PR and MIBs references to be relinquished, and calls
core_free_device_list_for_node() to release individual demo-mode MappedLUNs from
struct se_node_acl->device_list[] via core_update_device_list_for_node().

Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
(cherry picked from commit 135c3f59ed66eb1a54dbbf9eca5eeade272b5259)
---
 drivers/target/target_core_tpg.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c
index abfa81a..d15deaf 100644
--- a/drivers/target/target_core_tpg.c
+++ b/drivers/target/target_core_tpg.c
@@ -701,6 +701,8 @@ EXPORT_SYMBOL(core_tpg_register);
 
 int core_tpg_deregister(struct se_portal_group *se_tpg)
 {
+	struct se_node_acl *nacl, *nacl_tmp;
+
 	printk(KERN_INFO "TARGET_CORE[%s]: Deallocating %s struct se_portal_group"
 		" for endpoint: %s Portal Tag %u\n",
 		(se_tpg->se_tpg_type == TRANSPORT_TPG_TYPE_NORMAL) ?
@@ -714,6 +716,26 @@ int core_tpg_deregister(struct se_portal_group *se_tpg)
 
 	while (atomic_read(&se_tpg->tpg_pr_ref_count) != 0)
 		cpu_relax();
+	/*
+	 * Release any remaining demo-mode generated se_node_acl that have
+	 * not been released because of TFO->tpg_check_demo_mode_cache() == 1
+	 * in transport_deregister_session().
+	 */
+	spin_lock_bh(&se_tpg->acl_node_lock);
+	list_for_each_entry_safe(nacl, nacl_tmp, &se_tpg->acl_node_list,
+			acl_list) {
+		list_del(&nacl->acl_list);
+		se_tpg->num_node_acls--;
+		spin_unlock_bh(&se_tpg->acl_node_lock);
+
+		core_tpg_wait_for_nacl_pr_ref(nacl);
+		core_tpg_wait_for_mib_ref(nacl);
+		core_free_device_list_for_node(nacl, se_tpg);
+		TPG_TFO(se_tpg)->tpg_release_fabric_acl(se_tpg, nacl);
+
+		spin_lock_bh(&se_tpg->acl_node_lock);
+	}
+	spin_unlock_bh(&se_tpg->acl_node_lock);
 
 	if (se_tpg->se_tpg_type == TRANSPORT_TPG_TYPE_NORMAL)
 		core_tpg_release_virtual_lun0(se_tpg);
-- 
1.7.3.5


  parent reply	other threads:[~2011-01-29 18:36 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-29 18:36 [PATCH 00/24] target updates for .38-rc3 (v2) Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 01/24] target: iblock/pscsi claim checking for NULL instead of IS_ERR Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 02/24] target: fix dubious one-bit signed bitfield Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 03/24] target/iblock: Fix failed bd claim NULL pointer dereference Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 04/24] target: Fix memory leak on error path Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 05/24] target: Remove unneeded test of se_cmd Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 06/24] target/file: Fix memory leak in fd_set_configfs_dev_params() Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 07/24] target/iblock: Fix memory leak in iblock_set_configfs_dev_params Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 08/24] target: Fix memory leaks in target_core_dev_pr_store_attr_res_aptpl_metadata Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 09/24] target: Fix demo-mode MappedLUN shutdown UA/PR breakage Nicholas A. Bellinger
2011-01-29 18:36 ` Nicholas A. Bellinger [this message]
2011-01-29 18:36 ` [PATCH 11/24] target: tcm_mod_builder.py generated Makefile cleanups Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 12/24] target: do not include target_core_mib.h under include/target Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 13/24] target: remove EXTRA_CFLAGS Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 14/24] target: Call proc_mkdir + remove_proc_entry with NULL parameter Nicholas A. Bellinger
2011-01-29 20:18   ` James Bottomley
2011-01-29 20:43     ` Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 15/24] target: Convert backend ->create_virtdevice() call to return ERR_PTR Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 16/24] target: Drop nacl->device_list_lock on core_update_device_list_for_node failure Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 17/24] target: Remove unnecessary hba_dev_list walk + release from core_delete_hba Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 18/24] target: Remove unnecessary se_clear_dev_ports legacy code Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 19/24] target: Minor sparse warning fixes and annotations Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 20/24] target: Remove spurious double cast from structure macro accessors Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 21/24] target: Convert rd_build_device_space() to use errno Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 22/24] target: Remove unnecessary container_of() pointer check Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 23/24] target: Convert TMR REQ/RSP definitions to target namespace Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 24/24] target core v4.0.0-rc7 Nicholas A. Bellinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1296326184-16664-11-git-send-email-nab@linux-iscsi.org \
    --to=nab@linux-iscsi.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.