aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2016-05-02 09:45:20 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2016-05-10 04:19:11 -0400
commitfba81f8831b20272a97a990e5d47c332e9b1f65d (patch)
treebf8a65e7425f35ab07dcd5bf3826cc9e40f7548f
parentbc6e6bb470eda42f44bcac96c261cff1216577b3 (diff)
target: remove acl_stop
Ensure we can use list_empty on the sess_acl_list to remove the need for this flag. 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.c13
-rw-r--r--drivers/target/target_core_transport.c4
-rw-r--r--include/target/target_core_base.h1
3 files changed, 7 insertions, 11 deletions
diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c
index 88db4938600b..b1ac600f5b45 100644
--- a/drivers/target/target_core_tpg.c
+++ b/drivers/target/target_core_tpg.c
@@ -336,30 +336,27 @@ struct se_node_acl *core_tpg_add_initiator_node_acl(
336 return acl; 336 return acl;
337} 337}
338 338
339static void target_shutdown_sessions(struct se_node_acl *acl, bool acl_stop) 339static 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; 343 int ret;
344 344
345 spin_lock_irqsave(&acl->nacl_sess_lock, flags);
346 if (acl_stop)
347 acl->acl_stop = 1;
348restart: 345restart:
346 spin_lock_irqsave(&acl->nacl_sess_lock, flags);
349 list_for_each_entry(sess, &acl->acl_sess_list, sess_acl_list) { 347 list_for_each_entry(sess, &acl->acl_sess_list, sess_acl_list) {
350 if (sess->sess_tearing_down) 348 if (sess->sess_tearing_down)
351 continue; 349 continue;
352 if (!target_get_session(sess)) 350 if (!target_get_session(sess))
353 continue; 351 continue;
354 352
355 list_del(&sess->sess_acl_list); 353 list_del_init(&sess->sess_acl_list);
356 354
357 spin_unlock_irqrestore(&acl->nacl_sess_lock, flags); 355 spin_unlock_irqrestore(&acl->nacl_sess_lock, flags);
358 ret = acl->se_tpg->se_tpg_tfo->shutdown_session(sess); 356 ret = acl->se_tpg->se_tpg_tfo->shutdown_session(sess);
359 target_put_session(sess); 357 target_put_session(sess);
360 if (ret) 358 if (ret)
361 target_put_session(sess); 359 target_put_session(sess);
362 spin_lock_irqsave(&acl->nacl_sess_lock, flags);
363 goto restart; 360 goto restart;
364 } 361 }
365 spin_unlock_irqrestore(&acl->nacl_sess_lock, flags); 362 spin_unlock_irqrestore(&acl->nacl_sess_lock, flags);
@@ -375,7 +372,7 @@ void core_tpg_del_initiator_node_acl(struct se_node_acl *acl)
375 list_del(&acl->acl_list); 372 list_del(&acl->acl_list);
376 mutex_unlock(&tpg->acl_node_mutex); 373 mutex_unlock(&tpg->acl_node_mutex);
377 374
378 target_shutdown_sessions(acl, true); 375 target_shutdown_sessions(acl);
379 376
380 target_put_nacl(acl); 377 target_put_nacl(acl);
381 /* 378 /*
@@ -415,7 +412,7 @@ int core_tpg_set_initiator_node_queue_depth(
415 /* 412 /*
416 * Shutdown all pending sessions to force session reinstatement. 413 * Shutdown all pending sessions to force session reinstatement.
417 */ 414 */
418 target_shutdown_sessions(acl, false); 415 target_shutdown_sessions(acl);
419 416
420 pr_debug("Successfully changed queue depth to: %d for Initiator" 417 pr_debug("Successfully changed queue depth to: %d for Initiator"
421 " Node: %s on %s Target Portal Group: %u\n", acl->queue_depth, 418 " Node: %s on %s Target Portal Group: %u\n", acl->queue_depth,
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index ab2bf12975e1..ccd3a0eda0c8 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -499,8 +499,8 @@ void transport_deregister_session_configfs(struct se_session *se_sess)
499 se_nacl = se_sess->se_node_acl; 499 se_nacl = se_sess->se_node_acl;
500 if (se_nacl) { 500 if (se_nacl) {
501 spin_lock_irqsave(&se_nacl->nacl_sess_lock, flags); 501 spin_lock_irqsave(&se_nacl->nacl_sess_lock, flags);
502 if (se_nacl->acl_stop == 0) 502 if (!list_empty(&se_sess->sess_acl_list))
503 list_del(&se_sess->sess_acl_list); 503 list_del_init(&se_sess->sess_acl_list);
504 /* 504 /*
505 * If the session list is empty, then clear the pointer. 505 * If the session list is empty, then clear the pointer.
506 * Otherwise, set the struct se_session pointer from the tail 506 * Otherwise, set the struct se_session pointer from the tail
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 3e0dd86360a2..1d4e1cb7f373 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -536,7 +536,6 @@ struct se_node_acl {
536 char initiatorname[TRANSPORT_IQN_LEN]; 536 char initiatorname[TRANSPORT_IQN_LEN];
537 /* Used to signal demo mode created ACL, disabled by default */ 537 /* Used to signal demo mode created ACL, disabled by default */
538 bool dynamic_node_acl; 538 bool dynamic_node_acl;
539 bool acl_stop:1;
540 u32 queue_depth; 539 u32 queue_depth;
541 u32 acl_index; 540 u32 acl_index;
542 enum target_prot_type saved_prot_type; 541 enum target_prot_type saved_prot_type;