aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2016-05-02 09:45:25 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2016-05-10 04:19:49 -0400
commitd94331fab6d4d48280a5cea646352db90777966d (patch)
tree8d4814eb16f6708d70113a4701253c502b7ab71a
parent44f33d0fb5a7181cc34529c211d7b5039d8a0a4b (diff)
target: remove sess_kref and ->shutdown_session
Both of them are unused now that drivers handle any delayed session shutdown internally. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r--drivers/target/target_core_tpg.c14
-rw-r--r--drivers/target/target_core_transport.c23
-rw-r--r--include/target/target_core_base.h1
-rw-r--r--include/target/target_core_fabric.h6
4 files changed, 3 insertions, 41 deletions
diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c
index a81a37045403..d99752c6cd60 100644
--- a/drivers/target/target_core_tpg.c
+++ b/drivers/target/target_core_tpg.c
@@ -340,26 +340,18 @@ static void target_shutdown_sessions(struct se_node_acl *acl)
340{ 340{
341 struct se_session *sess; 341 struct se_session *sess;
342 unsigned long flags; 342 unsigned long flags;
343 int ret;
344 343
345restart: 344restart:
346 spin_lock_irqsave(&acl->nacl_sess_lock, flags); 345 spin_lock_irqsave(&acl->nacl_sess_lock, flags);
347 list_for_each_entry(sess, &acl->acl_sess_list, sess_acl_list) { 346 list_for_each_entry(sess, &acl->acl_sess_list, sess_acl_list) {
348 if (sess->sess_tearing_down) 347 if (sess->sess_tearing_down)
349 continue; 348 continue;
350 if (!target_get_session(sess))
351 continue;
352 349
353 list_del_init(&sess->sess_acl_list); 350 list_del_init(&sess->sess_acl_list);
354
355 spin_unlock_irqrestore(&acl->nacl_sess_lock, flags); 351 spin_unlock_irqrestore(&acl->nacl_sess_lock, flags);
356 if (acl->se_tpg->se_tpg_tfo->shutdown_session) 352
357 ret = acl->se_tpg->se_tpg_tfo->shutdown_session(sess); 353 if (acl->se_tpg->se_tpg_tfo->close_session)
358 else 354 acl->se_tpg->se_tpg_tfo->close_session(sess);
359 ret = 1;
360 target_put_session(sess);
361 if (ret)
362 target_put_session(sess);
363 goto restart; 355 goto restart;
364 } 356 }
365 spin_unlock_irqrestore(&acl->nacl_sess_lock, flags); 357 spin_unlock_irqrestore(&acl->nacl_sess_lock, flags);
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index 2914d4c68fea..6c089afe553a 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -239,7 +239,6 @@ struct se_session *transport_init_session(enum target_prot_op sup_prot_ops)
239 INIT_LIST_HEAD(&se_sess->sess_cmd_list); 239 INIT_LIST_HEAD(&se_sess->sess_cmd_list);
240 INIT_LIST_HEAD(&se_sess->sess_wait_list); 240 INIT_LIST_HEAD(&se_sess->sess_wait_list);
241 spin_lock_init(&se_sess->sess_cmd_lock); 241 spin_lock_init(&se_sess->sess_cmd_lock);
242 kref_init(&se_sess->sess_kref);
243 se_sess->sup_prot_ops = sup_prot_ops; 242 se_sess->sup_prot_ops = sup_prot_ops;
244 243
245 return se_sess; 244 return se_sess;
@@ -430,28 +429,6 @@ target_alloc_session(struct se_portal_group *tpg,
430} 429}
431EXPORT_SYMBOL(target_alloc_session); 430EXPORT_SYMBOL(target_alloc_session);
432 431
433static void target_release_session(struct kref *kref)
434{
435 struct se_session *se_sess = container_of(kref,
436 struct se_session, sess_kref);
437 struct se_portal_group *se_tpg = se_sess->se_tpg;
438
439 if (se_tpg->se_tpg_tfo->close_session)
440 se_tpg->se_tpg_tfo->close_session(se_sess);
441}
442
443int target_get_session(struct se_session *se_sess)
444{
445 return kref_get_unless_zero(&se_sess->sess_kref);
446}
447EXPORT_SYMBOL(target_get_session);
448
449void target_put_session(struct se_session *se_sess)
450{
451 kref_put(&se_sess->sess_kref, target_release_session);
452}
453EXPORT_SYMBOL(target_put_session);
454
455ssize_t target_show_dynamic_sessions(struct se_portal_group *se_tpg, char *page) 432ssize_t target_show_dynamic_sessions(struct se_portal_group *se_tpg, char *page)
456{ 433{
457 struct se_session *se_sess; 434 struct se_session *se_sess;
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 1d4e1cb7f373..b316b44d03f3 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -602,7 +602,6 @@ struct se_session {
602 struct list_head sess_cmd_list; 602 struct list_head sess_cmd_list;
603 struct list_head sess_wait_list; 603 struct list_head sess_wait_list;
604 spinlock_t sess_cmd_lock; 604 spinlock_t sess_cmd_lock;
605 struct kref sess_kref;
606 void *sess_cmd_map; 605 void *sess_cmd_map;
607 struct percpu_ida sess_tag_pool; 606 struct percpu_ida sess_tag_pool;
608}; 607};
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h
index 8ff6d40a294f..ec79da3b43df 100644
--- a/include/target/target_core_fabric.h
+++ b/include/target/target_core_fabric.h
@@ -50,10 +50,6 @@ struct target_core_fabric_ops {
50 */ 50 */
51 int (*check_stop_free)(struct se_cmd *); 51 int (*check_stop_free)(struct se_cmd *);
52 void (*release_cmd)(struct se_cmd *); 52 void (*release_cmd)(struct se_cmd *);
53 /*
54 * Called with spin_lock_bh(struct se_portal_group->session_lock held.
55 */
56 int (*shutdown_session)(struct se_session *);
57 void (*close_session)(struct se_session *); 53 void (*close_session)(struct se_session *);
58 u32 (*sess_get_index)(struct se_session *); 54 u32 (*sess_get_index)(struct se_session *);
59 /* 55 /*
@@ -123,8 +119,6 @@ void __transport_register_session(struct se_portal_group *,
123 struct se_node_acl *, struct se_session *, void *); 119 struct se_node_acl *, struct se_session *, void *);
124void transport_register_session(struct se_portal_group *, 120void transport_register_session(struct se_portal_group *,
125 struct se_node_acl *, struct se_session *, void *); 121 struct se_node_acl *, struct se_session *, void *);
126int target_get_session(struct se_session *);
127void target_put_session(struct se_session *);
128ssize_t target_show_dynamic_sessions(struct se_portal_group *, char *); 122ssize_t target_show_dynamic_sessions(struct se_portal_group *, char *);
129void transport_free_session(struct se_session *); 123void transport_free_session(struct se_session *);
130void target_put_nacl(struct se_node_acl *); 124void target_put_nacl(struct se_node_acl *);