Patch "target: Convert ACL change queue_depth se_session reference usage" has been added to the 4.4-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
target: Convert ACL change queue_depth se_session reference usage
to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
target-convert-acl-change-queue_depth-se_session-reference-usage.patch
and it can be found in the queue-4.4 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
d36ad77f702356afb1009d2987b0ab55da4c7d57Mon Sep 17 00:00:00 2001
From: Nicholas Bellinger <[email protected]>
Date: Thu, 7 Jan 2016 22:15:06 -0800
Subject: target: Convert ACL change queue_depth se_session reference usage
From: Nicholas Bellinger <[email protected]>
commit d36ad77f702356afb1009d2987b0ab55da4c7d57 upstream.
This patch converts core_tpg_set_initiator_node_queue_depth() to use struct se_node_acl->acl_sess_list when performing explicit se_tpg_tfo->shutdown_session() for active sessions, in order for new se_node_acl->queue_depth to take effect.
This follows how core_tpg_del_initiator_node_acl() currently works when invoking se_tpg_tfo->shutdown-session(), and ahead of the next patch to take se_node_acl->acl_kref during lookup, the extra get_initiator_node_acl() can go away. In order to achieve this, go ahead and change target_get_session() to use kref_get_unless_zero() and propigate up the return value to know when a session is already being released.
This is because se_node_acl->acl_group is already protecting se_node_acl->acl_group reference via configfs, and shutdown within core_tpg_del_initiator_node_acl() won't occur until sys_write() to core_tpg_set_initiator_node_queue_depth() attribute returns back to user-space.
Also, drop the left-over iscsi-target hack, and obtain se_portal_group->session_lock in lio_tpg_shutdown_session() internally. Remove iscsi-target wrapper and unused se_tpg + force parameters and associated code.
--- drivers/target/iscsi/iscsi_target_configfs.c | 29 +---- drivers/target/iscsi/iscsi_target_tpg.c | 10 - drivers/target/iscsi/iscsi_target_tpg.h | 2 drivers/target/target_core_tpg.c | 152 +++++++-------------------- drivers/target/target_core_transport.c | 4 include/target/target_core_fabric.h | 5 6 files changed, 56 insertions(+), 146 deletions(-)
drivers/target/iscsi/iscsi_target_configfs.c +7 -22
@@ -725,11 +725,8 @@ static ssize_t lio_target_nacl_cmdsn_depif (iscsit_get_tpg (tpg) <0 )return -EINVAL ; -/* -* iscsit_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_nacl, cmdsn_depth); pr_debug("LIO_Target_ConfigFS: %s/%s Set CmdSN Window: %u for" "InitiatorName: %s\n", config_item_name(wwn_ci),
@@ -1593,42 +1590,30 @@ static int lio_tpg_check_prot_fabric_onl }/* -* Called with spin_lock_irq(struct se_portal_group->session_lock) held -* or not held. -* -* Also, this function calls iscsit_inc_session_usage_count() on the +* This function calls iscsit_inc_session_usage_count() on the * struct iscsi_session in question. */ static int lio_tpg_shutdown_session (struct se_session *se_sess) {struct iscsi_session *sess = se_sess->fabric_sess_ptr; -struct se_portal_group *se_tpg = se_sess->se_tpg; -bool local_lock = false; - -if (!spin_is_locked (&se_tpg->session_lock)) { -spin_lock_irq (&se_tpg->session_lock); - local_lock = true; - } +struct se_portal_group *se_tpg = &sess->tpg->tpg_se_tpg; +spin_lock_bh (&se_tpg->session_lock);spin_lock (&sess->conn_lock);if (atomic_read (&sess->session_fall_back_to_erl0) ||atomic_read (&sess->session_logout) || (sess->time2retain_timer_flags &ISCSI_TF_EXPIRED )) {spin_unlock (&sess->conn_lock); -if (local_lock) -spin_unlock_irq (&sess->conn_lock); +spin_unlock_bh (&se_tpg->session_lock);return 0 ; }atomic_set (&sess->session_reinstatement,1 );spin_unlock (&sess->conn_lock);iscsit_stop_time2retain_timer (sess); -spin_unlock_irq (&se_tpg->session_lock); +spin_unlock_bh (&se_tpg->session_lock);iscsit_stop_session (sess,1 ,1 ); -if (!local_lock) -spin_lock_irq (&se_tpg->session_lock); -return 1 ; }
drivers/target/iscsi/iscsi_target_tpg.c +0 -10
@@ -589,16 +589,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 ;
drivers/target/iscsi/iscsi_target_tpg.h +0 -2
@@ -26,8 +26,6 @@ extern struct iscsi_tpg_np *iscsit_tpg_a 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 );
drivers/target/target_core_tpg.c +45 -107
212 lines not on this page · raw message
drivers/target/target_core_transport.c +2 -2
@@ -383,9 +383,9 @@ static void target_release_session(struc se_tpg->se_tpg_tfo->close_session (se_sess); } -void target_get_session (struct se_session *se_sess) +int target_get_session (struct se_session *se_sess) { -kref_get (&se_sess->sess_kref); +return kref_get_unless_zero (&se_sess->sess_kref); }EXPORT_SYMBOL (target_get_session);
include/target/target_core_fabric.h +2 -3
@@ -117,7 +117,7 @@ void __transport_register_session(struct struct se_node_acl *, struct se_session *, void *);void transport_register_session (struct se_portal_group *,struct se_node_acl *,struct se_session *,void *); -void target_get_session (struct se_session *); +int target_get_session (struct se_session *);void target_put_session (struct se_session *);ssize_t target_show_dynamic_sessions (struct se_portal_group *,char *);void transport_free_session (struct se_session *);
@@ -172,8 +172,7 @@ bool target_tpg_has_node_acl(struct se_p const char *);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 ); +int core_tpg_set_initiator_node_queue_depth (struct se_node_acl *,u32 );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 );
Patches currently in stable-queue which might be from [email protected] are
queue-4.4/target-convert-acl-change-queue_depth-se_session-reference-usage.patch queue-4.4/target-fix-compare_and_write_callback-handling-for-non-good-status.patch queue-4.4/target-fileio-fix-zero-length-read-and-write-handling.patch queue-4.4/iscsi-target-set-session_fall_back_to_erl0-when-forcing-reinstatement.patch