void transport_free_session(struct se_session *se_sess) { + spin_lock_irq(&se_sess->sess_cmd_lock); + while (wait_event_interruptible_lock_irq(se_sess->cmd_list_wq, + list_empty(&se_sess->sess_cmd_list), + se_sess->sess_cmd_lock) < 0) + ; + spin_unlock_irq(&se_sess->sess_cmd_lock); +
Hi Bart, Can you please explain to me why not to use wait_for_completion_interruptible() here?
if (se_sess->sess_cmd_map) { percpu_ida_destroy(&se_sess->sess_tag_pool); kvfree(se_sess->sess_cmd_map); @@ -2524,6 +2532,8 @@ static void target_release_cmd_kref(struct kref *kref) return; } list_del(&se_cmd->se_cmd_list); + if (list_empty(&se_cmd->se_cmd_list)) + wake_up(&se_sess->cmd_list_wq); spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); se_cmd->se_tfo->release_cmd(se_cmd); diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 8b9c727..229c1c2 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -606,6 +606,7 @@ struct se_session { struct list_head sess_cmd_list; struct list_head sess_wait_list; spinlock_t sess_cmd_lock; + wait_queue_head_t cmd_list_wq; struct kref sess_kref; void *sess_cmd_map; struct percpu_ida sess_tag_pool;
-- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html